FlightTests: a patrolling pilot never falls back to the root state

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-08 16:21:37 +02:00
commit 7217112873

View file

@ -235,6 +235,20 @@ public sealed class FlightTests : IDisposable
Assert.IsType<FollowState>(CurrentState(minion));
}
[Fact]
public void APatrollingPilotStaysOnPatrol()
{
var ship = Pilot(null);
var minion = new Minion(ship, FactionDoctrine.Default(_items.GameplaySettings).Combatant)
{ Task = new PatrolOrbitsTask { Circuit = new CultRecordKey[1] } };
for (var i = 0; i < 30; i++)
{
minion.Update(.1f);
if (i > 0) Assert.IsNotType<BaseState>(CurrentState(minion));
}
}
private static BaseState CurrentState(Agent agent) =>
(BaseState) typeof(Agent).GetField("_currentState", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(agent);