From 0c6f359cb5a76051cdf944bcbc0c4c855fda8415 Mon Sep 17 00:00:00 2001 From: soul Date: Wed, 21 Oct 2026 20:34:50 +0200 Subject: [PATCH] ProductLinesCatalogTests: FactionProductData's wire pin covers slot 8, and a record written before it is on the market Co-Authored-By: Claude Opus 5.5 --- .../ProductLinesCatalogTests.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/Aetheria.Shared.Tests/ProductLinesCatalogTests.cs b/tests/Aetheria.Shared.Tests/ProductLinesCatalogTests.cs index 7ce78218f..3bb4ceb60 100644 --- a/tests/Aetheria.Shared.Tests/ProductLinesCatalogTests.cs +++ b/tests/Aetheria.Shared.Tests/ProductLinesCatalogTests.cs @@ -140,8 +140,8 @@ public sealed class ProductLinesCatalogTests } } - // FactionProductData slot 7 is additive under the same schema id: a bin round-trips, and a record written before the slot - // existed (an array one element shorter) reads no bin. + // FactionProductData slots 7 and 8 are additive under the same schema id: a bin and NotOffered round-trip, a record written + // before slot 8 existed (an array one element shorter) is on the market, and one written before slot 7 also reads no bin. [Fact] public void BinIsSlotSevenAndACatalogWithoutItReadsNoBin() { @@ -150,12 +150,21 @@ public sealed class ProductLinesCatalogTests MessagePackSerializer.Serialize(new FactionProductData { Name = "Binned", Bin = new ProductBin { Floor = .67f } }, options), options); Assert.Equal(.67f, binned.Bin.Floor); + Assert.True(MessagePackSerializer.Deserialize( + MessagePackSerializer.Serialize(new FactionProductData { Name = "Unsold", NotOffered = true }, options), options).NotOffered); + var bytes = MessagePackSerializer.Serialize(new FactionProductData { Name = "Old", Description = "d" }, options); - Assert.Equal(0x98, bytes[0]); - Assert.Equal(0xC0, bytes[^1]); - var before = new byte[] { 0x97 }.Concat(bytes.Skip(1).Take(bytes.Length - 2)).ToArray(); + Assert.Equal(0x99, bytes[0]); + Assert.Equal(0xC0, bytes[^2]); + Assert.Equal(0xC2, bytes[^1]); + var beforeNotOffered = new byte[] { 0x98 }.Concat(bytes.Skip(1).Take(bytes.Length - 2)).ToArray(); + var offered = MessagePackSerializer.Deserialize(beforeNotOffered, options); + Assert.Equal("Old", offered.Name); + Assert.False(offered.NotOffered); + var before = new byte[] { 0x97 }.Concat(bytes.Skip(1).Take(bytes.Length - 3)).ToArray(); var old = MessagePackSerializer.Deserialize(before, options); Assert.Equal("Old", old.Name); Assert.Null(old.Bin); + Assert.False(old.NotOffered); } }