StationServices tests: a full first station bay does not refuse a sale; worn docking bays are mended

Kills the two survivors Stryker left in StationServices.cs: Any() to All() over the station's bays, and Concat() to Except() over the docking bays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-06 22:50:58 +02:00
commit 1baa89645d

View file

@ -135,6 +135,29 @@ public sealed class StationServicesTests : IDisposable
Assert.Contains(other, from.Cargo.Keys);
}
// A station's first bay being full is no reason to refuse: the goods go to whichever bay takes them.
[Fact]
public void TrySell_uses_any_station_bay_that_takes_the_goods()
{
var ship = Ship();
var from = ship.CargoBays.Single();
var gun = Mint("Gun");
var ore = Ore(10);
Assert.True(from.TryStore(gun));
Assert.True(from.TryStore(ore));
var station = Station();
Assert.True(station.TryEquip(Mint("Crate"), new int2(2, 2)));
var full = station.CargoBays[0];
var open = station.CargoBays[1];
while (full.TryStore(Mint("Gun"))) { }
var credits = 0;
Assert.True(StationServices.TrySell(from, station, gun, ref credits));
Assert.True(StationServices.TrySell(from, station, ore, ref credits));
Assert.Contains(gun, open.Cargo.Keys);
Assert.Contains(ore, open.Cargo.Keys);
}
[Fact]
public void Repair_restores_and_charges()
{
@ -166,6 +189,19 @@ public sealed class StationServicesTests : IDisposable
Assert.Equal(0, StationServices.RepairCost(_items, ship));
}
[Fact]
public void Repair_counts_docking_bays_as_gear()
{
var ship = Ship();
Assert.True(ship.TryEquip(Mint("Berth"), new int2(2, 2)));
var berth = ship.DockingBays.Single().EquippableItem;
berth.Durability = 3;
Assert.True(StationServices.RepairCost(_items, ship) > 0, "a worn docking bay costs to mend");
var credits = 1000000;
Assert.True(StationServices.TryRepair(ship, ref credits));
Assert.Equal(6, berth.Durability);
}
[Fact]
public void Repair_counts_cargo_bays_as_gear()
{