diff --git a/tests/Aetheria.Shared.Tests/LoadoutTests.cs b/tests/Aetheria.Shared.Tests/LoadoutTests.cs index 71fcc8d30..cbceb900c 100644 --- a/tests/Aetheria.Shared.Tests/LoadoutTests.cs +++ b/tests/Aetheria.Shared.Tests/LoadoutTests.cs @@ -185,22 +185,18 @@ public sealed class LoadoutTests : IDisposable Assert.Equal(1000 - 115, credits); } - // Two more Lamp products, written so insertion order (z before a) disagrees with record-key order. + // Two more Lamp products, upserted into the live cache so its enumeration order (z before a) disagrees with + // record-key order; a reopened snapshot could already hand them back sorted. [Fact] public void FirstAvailableProductInKeyOrderBuildsTheSlot() { - using (var catalog = AetheriaStores.Open(Catalog, catalogWritable: true)) - { - var maker = catalog.RefOf(catalog.GetByName("Maker")); - var lamp = new CultRecordRef(catalog.RefOf(catalog.GetByName("Lamp")).Key); - catalog.Commit(batch => - { - foreach (var key in new[] { "lamp-z", "lamp-a" }) - batch.Upsert(typeof(FactionProductData), new FactionProductData { Name = key, Design = lamp, Manufacturer = maker }, new CultRecordKey(key)); - }); - } + using var cache = AetheriaStores.Open(Catalog, catalogWritable: true); + var maker = cache.RefOf(cache.GetByName("Maker")); + var lamp = new CultRecordRef(cache.RefOf(cache.GetByName("Lamp")).Key); + foreach (var key in new[] { "lamp-z", "lamp-a" }) + cache.Commit(batch => batch.Upsert(typeof(FactionProductData), new FactionProductData { Name = key, Design = lamp, Manufacturer = maker }, new CultRecordKey(key))); + Assert.Equal(new[] { "lamp-z", "lamp-a" }, cache.GetAll().Select(p => p.Name).Where(name => name.StartsWith("lamp-"))); - using var cache = Open(); var items = new ItemManager(cache, RunSaveTests.TestSettings(), _ => { }); var hand = HandBuilt(cache); string LampProduct(Predicate available, List failures)