diff --git a/tests/Aetheria.Shared.Tests/RunStartTests.cs b/tests/Aetheria.Shared.Tests/RunStartTests.cs index 6619d25ca..92da56ce2 100644 --- a/tests/Aetheria.Shared.Tests/RunStartTests.cs +++ b/tests/Aetheria.Shared.Tests/RunStartTests.cs @@ -155,6 +155,19 @@ public sealed partial class RunStartTests : IDisposable private bool IsInstalledPlant(FactionProductData product) => product.NotOffered && _cache.Get(product.Design) is EquippableItemData design && design.HardpointType == HardpointType.Facility; + // The reach rule's one exemption is station plant: the Crew Quarters' product is, a not-offered product of interior gear is not, and an + // offered product of Facility gear is not (it is a draw like any other). + [Fact] + public void TheReachExemptionIsStationPlantOnly() + { + var quarters = _cache.Get(new CultRecordKey("product:habitation:crew-quarters")); + Assert.True(IsInstalledPlant(quarters)); + var heater = _cache.GetAll().First(LoadoutGenerator.IsHeater); + var heaterRef = new CultRecordRef(_cache.RefOf(heater).Key); + Assert.False(IsInstalledPlant(new FactionProductData { Name = "Hidden Heater", Design = heaterRef, Manufacturer = quarters.Manufacturer, NotOffered = true })); + Assert.False(IsInstalledPlant(new FactionProductData { Name = "Offered Quarters", Design = quarters.Design, Manufacturer = quarters.Manufacturer, NotOffered = false })); + } + private string Maker(FactionProductData product) => product == null ? "nobody" : _cache.Get(product.Manufacturer)?.Name ?? "nobody"; // Every faction's stations, in a main-sector galaxy, carry a heater and a reactor, and nothing, equipped or diff --git a/tests/Aetheria.Shared.Tests/StationFacilityRoomTests.cs b/tests/Aetheria.Shared.Tests/StationFacilityRoomTests.cs index eaf16a690..31e068a1a 100644 --- a/tests/Aetheria.Shared.Tests/StationFacilityRoomTests.cs +++ b/tests/Aetheria.Shared.Tests/StationFacilityRoomTests.cs @@ -56,6 +56,22 @@ public sealed class StationFacilityRoomTests if (hull.HullType == HullType.Station) Assert.Contains(hull.Hardpoints, row => row.Type == HardpointType.Facility); } + // The census counts the Crew Quarters' row: with Zenith's rows cut to its kind's own facility (in memory), the faults name the Crew + // Quarters and nothing else; with the second row back they are empty. + [Fact] + public void TheCensusCountsTheCrewQuartersRow() + { + using var cache = RestoredHullsTests.OpenCatalog(); + var zenith = Assert.Single(cache.GetAll(), hull => hull.Name == "Zenith"); + Assert.Empty(StationKinds.FacilityRoomFaults(cache)); + var rows = zenith.Hardpoints.Where(row => row.Type == HardpointType.Facility).ToArray(); + Assert.Equal(2, rows.Length); + zenith.Hardpoints.Remove(rows[1]); + var faults = StationKinds.FacilityRoomFaults(cache); + Assert.NotEmpty(faults); + Assert.All(faults, line => Assert.Contains("Crew Quarters", line)); + } + // Positive control: Zenith's Facility rows taken away (in memory, on a read-only catalog), the census names the hull, a kind it // serves and that kind's facility. [Fact]