using BigRegister.Domain.Registrations; namespace BigRegister.Tests.Domain; public class HerregistratieRuleTests { private static Registration Active(DateOnly deadline) => new( "19012345601", "Test", "Arts", new DateOnly(2012, 9, 1), new DateOnly(1985, 3, 14), new RegistrationStatus(StatusTag.Geregistreerd, HerregistratieDatum: deadline)); [Fact] public void Eligible_within_window() { var (eligible, reason) = HerregistratieRule.Evaluate( Active(new DateOnly(2027, 3, 1)), today: new DateOnly(2026, 6, 26)); Assert.True(eligible); Assert.Contains("12 maanden", reason); } [Fact] public void Not_eligible_before_window() { var (eligible, _) = HerregistratieRule.Evaluate( Active(new DateOnly(2027, 3, 1)), today: new DateOnly(2025, 1, 1)); Assert.False(eligible); } [Fact] public void Eligible_on_window_boundary() { // window opens exactly 12 months before the deadline var (eligible, _) = HerregistratieRule.Evaluate( Active(new DateOnly(2027, 3, 1)), today: new DateOnly(2026, 3, 1)); Assert.True(eligible); } [Fact] public void Suspended_is_not_eligible() { var reg = Active(new DateOnly(2027, 3, 1)) with { Status = new RegistrationStatus(StatusTag.Geschorst, GeschorstTot: new DateOnly(2027, 1, 1), Reden: "x"), }; var (eligible, _) = HerregistratieRule.Evaluate(reg, today: new DateOnly(2026, 6, 26)); Assert.False(eligible); } [Fact] public void Status_consistency_invariant() { Assert.True(HerregistratieRule.IsStatusConsistent( new RegistrationStatus(StatusTag.Geregistreerd, HerregistratieDatum: new DateOnly(2027, 3, 1)))); Assert.False(HerregistratieRule.IsStatusConsistent( new RegistrationStatus(StatusTag.Geregistreerd))); } }