using Ludarium.Application; using Ludarium.Domain; namespace Ludarium.UnitTests; public sealed class ClaimPolicyTests { [Fact] public void LockedManualClaimOverridesAutomaticEvidenceAndSupersessionIsAppendOnly() { var entity = Guid.NewGuid(); var now = DateTimeOffset.UtcNow; var automatic = Claim(Guid.NewGuid(), entity, "Automatic title", Confidence.Deterministic, false, now); var manual = Claim(Guid.NewGuid(), entity, "Operator title", Confidence.High, true, now.AddSeconds(1)); var corrected = Claim(Guid.NewGuid(), entity, "Corrected title", Confidence.Deterministic, true, now.AddSeconds(2), manual.Id); Assert.Equal("Operator title", ClaimPolicy.SelectEffective([automatic, manual])?.Value); Assert.Equal("Corrected title", ClaimPolicy.SelectEffective([automatic, manual, corrected])?.Value); Assert.Equal(3, new[] { automatic, manual, corrected }.Length); } private static MetadataClaim Claim(Guid id, Guid entity, string value, Confidence confidence, bool locked, DateTimeOffset at, Guid? supersedes = null) => new(id, "Game", entity, "title", value, locked ? "Manual" : "Analyzer", "test", confidence, [], locked, at, supersedes); }