CultNet tests: read the written keys without a lambda over a ref struct
All checks were successful
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Successful in 24m13s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-28 05:47:39 +01:00
commit 34b0fa4c60

View file

@ -261,12 +261,12 @@ namespace GameCult.Networking.Tests
var bytes = MessagePackSerializer.Serialize(type, instance, CultNetSchemaMessageSerialization.Options);
var reader = new MessagePackReader(bytes);
var written = Enumerable.Range(0, reader.ReadMapHeader()).Select(_ =>
var written = new System.Collections.Generic.List<string>();
for (var entries = reader.ReadMapHeader(); entries > 0; entries--)
{
var key = reader.ReadString()!;
written.Add(reader.ReadString()!);
reader.Skip();
return key;
}).ToArray();
}
var declared = KeyedProperties(type).Select(p => p.GetCustomAttribute<KeyAttribute>()!.StringKey!).ToArray();
Assert.That(written, Is.EquivalentTo(declared), $"{type.Name}: its formatter must write exactly the [Key] members");