From 6e70626bf92bfc1102494f2ce60971416a49742f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 15 Oct 2026 03:36:15 +0200 Subject: [PATCH] ElementIdEngineTests: the keyed self-enumerating node round-trips through MessagePack with its ids Co-Authored-By: Claude Sonnet 5.5 --- tests/GameCult.Caching.Tests/ElementIdEngineTests.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/GameCult.Caching.Tests/ElementIdEngineTests.cs b/tests/GameCult.Caching.Tests/ElementIdEngineTests.cs index 3f6b084e..29fc497b 100644 --- a/tests/GameCult.Caching.Tests/ElementIdEngineTests.cs +++ b/tests/GameCult.Caching.Tests/ElementIdEngineTests.cs @@ -498,6 +498,10 @@ namespace GameCult.Caching.Tests Assert.That(Assign(root, "r", deterministic: true), Is.EqualTo(3)); Assert.That(root.Nodes[0].Id, Has.Length.EqualTo(12)); Assert.That(root.Nodes[0].Children[0].Children[0].Id, Has.Length.EqualTo(12)); + var options = GameCult.Caching.MessagePack.CultDocumentMessagePackSerialization.Options; + var back = MessagePackSerializer.Deserialize(MessagePackSerializer.Serialize(root, options), options); + Assert.That(back.Nodes[0].Id, Is.EqualTo(root.Nodes[0].Id), "MessagePack writes the node by key, ids included"); + Assert.That(back.Nodes[0].Children[0].Children[0].Id, Is.EqualTo(root.Nodes[0].Children[0].Children[0].Id)); // An unkeyed type that enumerates itself holds no element list and ends the type walk. var unkeyed = CultElementIds.Inspect(typeof(HUNode));