using Nonemm.Contests.Rules; using Nonemm.Core; namespace Nonemm.Contests.Tests; /// What N1MM does with a contact the operator has taken out of the claimed /// score, and with one a log N1MM wrote has marked as a dupe. The two are not /// the same: an unclaimed contact is left out of the score and out of both the /// dupe search and the multiplier search, while a contact marked `D` still /// takes a dupe and a multiplier away from a later contact. public class ExcludedContactTests { private static ContestLog LogFor() => new(new CqWorldWide(ModeCategory.Cw), TestLog.Germany, TestLog.CountryFile); private static Qso Japan(string call = "JA1XYZ", DateTime? at = null) => TestLog.Contact(call, zone: 25, at: at); private static readonly DateTime Later = new(2026, 5, 30, 13, 0, 0, DateTimeKind.Utc); [Fact] public void AnUnclaimedContactScoresNothing() { ContestLog log = LogFor(); log.Add(Japan() with { IsClaimed = false }); Assert.Equal(0, log.Tally.Qsos); Assert.Equal(0, log.Tally.Points); Assert.Equal(0, log.Tally.TotalMultipliers); Assert.Equal(0, log.TotalScore); } [Fact] public void AnUnclaimedContactDoesNotDupeALaterOne() { ContestLog log = LogFor(); log.Add(Japan() with { IsClaimed = false }); Assert.False(log.IsWorked(Japan(at: Later))); } [Fact] public void AnUnclaimedContactLeavesItsMultipliersForALaterOne() { ContestLog log = LogFor(); log.Add(Japan() with { IsClaimed = false }); Verdict later = log.Judge(Japan("JH1ABC", Later)); Assert.Equal([1, 2], later.NewMultipliers.Select(m => m.Index).ToList()); } /// N1MM searches for dupes and multipliers among the claimed contacts /// whether or not they are marked as a dupe, so the second contact here /// gets no multiplier and the multiplier is lost from the score. [Fact] public void AContactMarkedAsADupeTakesItsMultipliersOutOfTheScore() { ContestLog log = LogFor(); log.Add(Japan() with { ContactType = "D" }); Assert.Equal(0, log.Tally.Qsos); Assert.Equal(0, log.Tally.TotalMultipliers); Assert.Empty(log.Judge(Japan("JH1ABC", Later)).NewMultipliers); Assert.True(log.IsWorked(Japan(at: Later))); } }