UnionArmGuardTests: drop the unbuildable-AllowPrivate fixture
No fixture makes StandardResolverAllowPrivate throw when asked for a formatter (Stryker: the catch stays NoCoverage), so the test pinned nothing the claim tests do not. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8ddb8a03e1
commit
494ad9abfb
1 changed files with 0 additions and 42 deletions
|
|
@ -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<InvalidOperationException>(() => 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<ApHookArm> Items = new();
|
||||
}
|
||||
|
||||
private sealed class ApHookFormatter : IMessagePackFormatter<ApHookArm>
|
||||
{
|
||||
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<LcValue>)) return (IMessagePackFormatter<T>)(object)new ValuesFormatter();
|
||||
if (typeof(T) == typeof(List<Pair>)) return (IMessagePackFormatter<T>)(object)new PointsFormatter();
|
||||
if (typeof(T) == typeof(FbArm)) return global::MessagePack.Resolvers.StandardResolver.Instance.GetFormatter<T>();
|
||||
if (typeof(T) == typeof(ApHookArm)) return (IMessagePackFormatter<T>)(object)new ApHookFormatter();
|
||||
if (typeof(T) == typeof(ApArm) || typeof(T) == typeof(ApDoc) || typeof(T) == typeof(List<ApArm>) ||
|
||||
typeof(T) == typeof(ApPlainArm) || typeof(T) == typeof(ApPlainDoc) || typeof(T) == typeof(List<ApPlainArm>))
|
||||
return global::MessagePack.Resolvers.StandardResolverAllowPrivate.Instance.GetFormatter<T>();
|
||||
|
|
|
|||
Loading…
Reference in a new issue