37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using System.Reflection;
|
|
using AcDream.App.Rendering;
|
|
using AcDream.App.Net;
|
|
using AcDream.Core.Net;
|
|
|
|
namespace AcDream.App.Tests.Net;
|
|
|
|
public sealed class GameWindowLiveSessionOwnershipTests
|
|
{
|
|
private const BindingFlags PrivateInstance =
|
|
BindingFlags.Instance | BindingFlags.NonPublic;
|
|
|
|
[Fact]
|
|
public void GameWindowRetainsOnlyTheLifecycleControllerSessionOwner()
|
|
{
|
|
FieldInfo[] fields = typeof(GameWindow).GetFields(PrivateInstance);
|
|
|
|
Assert.Contains(
|
|
fields,
|
|
field => field.Name == "_liveSessionController"
|
|
&& field.FieldType == typeof(LiveSessionController));
|
|
Assert.DoesNotContain(fields, field => field.Name == "_liveSession");
|
|
Assert.DoesNotContain(fields, field => field.FieldType == typeof(WorldSession));
|
|
Assert.DoesNotContain(fields, field => field.Name == "_liveSessionEvents");
|
|
Assert.DoesNotContain(fields, field => field.Name == "_liveSessionCommands");
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("TryStartLiveSession")]
|
|
[InlineData("ClearInboundEntityState")]
|
|
[InlineData("WireLiveSessionEvents")]
|
|
[InlineData("DisposeLiveSessionRouting")]
|
|
public void DisplacedLifecycleBodiesAreAbsent(string methodName)
|
|
{
|
|
Assert.Null(typeof(GameWindow).GetMethod(methodName, PrivateInstance));
|
|
}
|
|
}
|