RunStartTests: the own-maker and factionless reach claims hold for every product LoadoutGenerator.IsOffered offers

Ruling census-tests-read-the-owners.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-10-22 00:41:09 +02:00
commit 9ac8f23307
2 changed files with 6 additions and 4 deletions

View file

@ -55,7 +55,8 @@ public sealed partial class RunStartTests
var galaxy = MainSectorGalaxy();
AbsentMaker("AbsentToAll");
var generator = new LoadoutGenerator(ref _items.Random, _items, galaxy, galaxy.Entrance, null, .5f);
var products = _cache.GetAll<FactionProductData>().Where(p => p.Manufacturer.IsSet()).ToArray();
// Every offered product (LoadoutGenerator.IsOffered); a not-offered one is available to nobody.
var products = _cache.GetAll<FactionProductData>().Where(p => p.Manufacturer.IsSet() && LoadoutGenerator.IsOffered(_cache, p)).ToArray();
Assert.NotEmpty(products);
Assert.All(products, product => Assert.True(generator.IsAvailable(product), product.Name));
}

View file

@ -178,13 +178,14 @@ public sealed partial class RunStartTests : IDisposable
}
}
// A faction always reaches its own manufacturer's gear: in a main-sector galaxy every product a faction makes is
// on offer to that faction, allegiance or not. And an allegiance map lists only other factions.
// A faction always reaches its own manufacturer's gear: in a main-sector galaxy every offered product a faction makes
// (LoadoutGenerator.IsOffered, the market's one owner) is on offer to that faction, allegiance or not. And an
// allegiance map lists only other factions.
[Fact]
public void AFactionReachesItsOwnGearAndItsAllegianceNamesOnlyOthers()
{
var galaxy = MainSectorGalaxy();
var products = _cache.GetAll<FactionProductData>().Where(p => p.Manufacturer.IsSet()).ToArray();
var products = _cache.GetAll<FactionProductData>().Where(p => p.Manufacturer.IsSet() && LoadoutGenerator.IsOffered(_cache, p)).ToArray();
foreach (var faction in galaxy.Factions)
{
Assert.DoesNotContain(faction.Allegiance.Keys, key => key.Key.Equals(_cache.RefOf(faction).Key));