Tests: the zone gives each admitted pilot its own id

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-17 20:56:28 +02:00
commit 27be39284f

View file

@ -323,6 +323,22 @@ public sealed class ConsumableAiTests : IDisposable
Assert.Equal(overdrives, s.Active(s.Overdrive));
}
// The zone gives each pilot it admits its own ordinal, from 1 and never reused: the key of its own dice
// (SimulationDice.CombatSampleStream). Kills: Zone.CreateAgent not setting Agent.Id.
[Fact]
public void TheZoneGivesEachAdmittedPilotItsOwnId()
{
var s = Build(carryOverdrive: true);
var first = s.Zone.Agents.Single().Id;
Assert.True(first > 0, "an admitted pilot has an id");
Assert.True(s.Zone.Remove(s.Agent));
s.Agent.Deactivate();
s.Zone.Admit(s.Agent, piloted: true);
Assert.True(s.Zone.Agents.Last(a => ReferenceEquals(a.Ship, s.Agent)).Id > first, "a re-admitted pilot is a new id");
}
// The production path for the optimum: a ship the zone admits as piloted derives it from its gun's live stats
// before it needs it, and re-derives it when its loadout changes. The gun's effective range is 500 and the
// heavy gun's is 800, so the optimum moves with the weapons it has now.