acdream/tests/AcDream.App.Tests/Net/GameWindowLiveSessionOwnershipTests.cs
Erik 557eb7ef6b refactor(net): own live session composition
Extract reset, selection, entered-world, and route construction behind LiveSessionHost while preserving the sole LiveSessionController authority. Retain partial route and subscription cleanup for retry, and replace the embedded ACE-only shortcut with the exact named-retail unsigned skill formula.

Co-authored-by: Codex <codex@openai.com>
2026-07-22 10:36:06 +02:00

45 lines
1.7 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 GameWindowRetainsControllerAndFocusedHostButNoMirroredSession()
{
FieldInfo[] fields = typeof(GameWindow).GetFields(PrivateInstance);
Assert.Contains(
fields,
field => field.Name == "_liveSessionController"
&& field.FieldType == typeof(LiveSessionController));
Assert.Contains(
fields,
field => field.Name == "_liveSessionHost"
&& field.FieldType == typeof(LiveSessionHost));
Assert.DoesNotContain(fields, field => field.Name == "_liveSession");
Assert.DoesNotContain(fields, field => field.FieldType == typeof(WorldSession));
Assert.DoesNotContain(fields, field => field.FieldType == typeof(LiveSessionResetPlan));
Assert.DoesNotContain(fields, field => field.Name == "_liveSessionEvents");
Assert.DoesNotContain(fields, field => field.Name == "_liveSessionCommands");
}
[Theory]
[InlineData("TryStartLiveSession")]
[InlineData("ClearInboundEntityState")]
[InlineData("WireLiveSessionEvents")]
[InlineData("DisposeLiveSessionRouting")]
[InlineData("CreateLiveSessionBinding")]
[InlineData("ApplyLiveSessionSelection")]
[InlineData("ApplyLiveSessionEnteredWorld")]
public void DisplacedLifecycleBodiesAreAbsent(string methodName)
{
Assert.Null(typeof(GameWindow).GetMethod(methodName, PrivateInstance));
}
}