diff --git a/tests/GameCult.Caching.Tests/UnionArmGuardTests.cs b/tests/GameCult.Caching.Tests/UnionArmGuardTests.cs index eed82076..7c98927b 100644 --- a/tests/GameCult.Caching.Tests/UnionArmGuardTests.cs +++ b/tests/GameCult.Caching.Tests/UnionArmGuardTests.cs @@ -357,47 +357,6 @@ namespace GameCult.Caching.Tests Assert.That(Convert.ToHexString(plainBytes), Is.EqualTo(Convert.ToHexString(MessagePackSerializer.Serialize(plain, CultDocumentMessagePackSerialization.Options)))); } - // StandardResolverAllowPrivate cannot always build a formatter (a private [Key] delegate member has none). That is not an - // escape from the claim check: a resolver formatting such a type is refused like any other. - [Test] - public void AFormatterThatStandardResolverAllowPrivateCannotBuildStillClaims() - { - var registry = CultDocumentRegistry.ForTypes(new[] { typeof(ApHookDoc) }); - var doc = new ApHookDoc { Id = "r1", Items = { new ApHookArm { Id = "00000000000c" } } }; - - var thrown = Assert.Throws(() => CultDocumentMessagePackSerialization.SerializeUntyped(doc, typeof(ApHookDoc), registry))!; - - Assert.That(thrown.Message, Does.Contain(nameof(ListClaimResolver)).And.Contain(nameof(ApHookArm))); - } - - [MessagePackObject] - public sealed class ApHookArm - { - [Key(0)] [CultElementId] public string Id = string.Empty; -#pragma warning disable CS0169, CS0649 - [Key(1)] private Action? hook; -#pragma warning restore CS0169, CS0649 - } - - [CultDocument("tests.ap_hook_doc", "tests.ap_hook_doc.v1")] - [MessagePackObject] - public sealed class ApHookDoc - { - [Key(0)] [CultName] public string Id = string.Empty; - [Key(1)] public List Items = new(); - } - - private sealed class ApHookFormatter : IMessagePackFormatter - { - public void Serialize(ref MessagePackWriter writer, ApHookArm value, MessagePackSerializerOptions options) => writer.WriteNil(); - - public ApHookArm Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) - { - reader.Skip(); - return new ApHookArm(); - } - } - [MessagePackObject] public sealed class ApArm { @@ -498,7 +457,6 @@ namespace GameCult.Caching.Tests if (typeof(T) == typeof(List)) return (IMessagePackFormatter)(object)new ValuesFormatter(); if (typeof(T) == typeof(List)) return (IMessagePackFormatter)(object)new PointsFormatter(); if (typeof(T) == typeof(FbArm)) return global::MessagePack.Resolvers.StandardResolver.Instance.GetFormatter(); - if (typeof(T) == typeof(ApHookArm)) return (IMessagePackFormatter)(object)new ApHookFormatter(); if (typeof(T) == typeof(ApArm) || typeof(T) == typeof(ApDoc) || typeof(T) == typeof(List) || typeof(T) == typeof(ApPlainArm) || typeof(T) == typeof(ApPlainDoc) || typeof(T) == typeof(List)) return global::MessagePack.Resolvers.StandardResolverAllowPrivate.Instance.GetFormatter();