FlightTests: combat transitions are looked for across the patrol sub-states' own hand-overs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c1b83e84e5
commit
a2ad79a68e
1 changed files with 13 additions and 7 deletions
|
|
@ -558,23 +558,28 @@ public sealed class FlightTests : IDisposable
|
|||
return minion;
|
||||
}
|
||||
|
||||
// Patrol's own sub-states may hand over to one another first, so a transition out of patrol is looked for within a
|
||||
// few updates; none of them ever reaches combat unless the interrupt covers the patrol sub-states.
|
||||
private static void UpdateUntil(Minion minion, Func<bool> done)
|
||||
{
|
||||
for (var i = 0; i < 3 && !done(); i++) minion.Update(.1f);
|
||||
Assert.True(done(), "pilot is in " + CurrentState(minion).GetType().Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ATargetPullsAPatrollingPilotIntoCombatAndLosingItReturnsToPatrol()
|
||||
{
|
||||
var ship = Pilot(null);
|
||||
var minion = PatrollingMinion(ship);
|
||||
|
||||
var track = Track();
|
||||
See(ship, track);
|
||||
|
||||
ship.SetTarget(new TargetRef(track));
|
||||
minion.Update(.1f);
|
||||
Assert.IsType<CombatState>(CurrentState(minion));
|
||||
UpdateUntil(minion, () => CurrentState(minion) is CombatState);
|
||||
|
||||
ship.SetTarget(TargetRef.None);
|
||||
minion.Update(.1f);
|
||||
Assert.IsNotType<CombatState>(CurrentState(minion));
|
||||
minion.Update(.1f);
|
||||
Assert.IsType<PatrolOrbitsState>(CurrentState(minion));
|
||||
UpdateUntil(minion, () => !(CurrentState(minion) is CombatState));
|
||||
UpdateUntil(minion, () => CurrentState(minion) is PatrolOrbitsState || CurrentState(minion) is MoveToOrbitState);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -585,6 +590,7 @@ public sealed class FlightTests : IDisposable
|
|||
var track = Track();
|
||||
See(ship, track);
|
||||
ship.SetTarget(new TargetRef(track));
|
||||
UpdateUntil(minion, () => CurrentState(minion) is CombatState);
|
||||
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue