refactor(net): converge live session state reset

This commit is contained in:
Erik 2026-07-21 12:00:48 +02:00
parent 78a9223b65
commit 4f31a5085f
35 changed files with 1460 additions and 83 deletions

View file

@ -122,6 +122,33 @@ public sealed class ItemInteractionControllerTests
Assert.Empty(h.UseWithTarget);
}
[Fact]
public void ResetSession_RetryNotifiesEveryStateObserver()
{
var h = new Harness();
h.Controller.InteractionState.EnterExamine();
h.Controller.IncrementBusyCount();
bool fail = true;
int delivered = 0;
h.Controller.StateChanged += () =>
{
if (fail)
{
fail = false;
throw new InvalidOperationException("transient");
}
};
h.Controller.StateChanged += () => delivered++;
Assert.Throws<AggregateException>(h.Controller.ResetSession);
Assert.Equal(1, delivered);
Assert.Equal(0, h.Controller.BusyCount);
Assert.Equal(InteractionMode.None, h.Controller.InteractionState.Current);
h.Controller.ResetSession();
Assert.Equal(2, delivered);
}
[Fact]
public void ExternalContainerUse_RequestsGroundObjectAndSendsUse()
{