refactor(net): converge live session state reset
This commit is contained in:
parent
78a9223b65
commit
4f31a5085f
35 changed files with 1460 additions and 83 deletions
|
|
@ -29,4 +29,31 @@ public sealed class InteractionStateTests
|
|||
Assert.Throws<ArgumentOutOfRangeException>(() => state.EnterUseItemOnTarget(0));
|
||||
Assert.Equal(InteractionMode.None, state.Current);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResetSession_RetryRepublishesAndOneObserverCannotStarveAnother()
|
||||
{
|
||||
var state = new InteractionState();
|
||||
state.EnterExamine();
|
||||
bool fail = true;
|
||||
int delivered = 0;
|
||||
state.Changed += _ =>
|
||||
{
|
||||
if (fail)
|
||||
{
|
||||
fail = false;
|
||||
throw new InvalidOperationException("transient");
|
||||
}
|
||||
};
|
||||
state.Changed += transition =>
|
||||
{
|
||||
Assert.Equal(InteractionMode.None, transition.Current);
|
||||
delivered++;
|
||||
};
|
||||
|
||||
Assert.Throws<AggregateException>(state.ResetSession);
|
||||
Assert.Equal(1, delivered);
|
||||
state.ResetSession();
|
||||
Assert.Equal(2, delivered);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue