test(domain): a document-wait timeout expires the registration to Verlopen (refs #102)

RED: Registration.Expire() moves an open registration to a new terminal
Verlopen status, needs no zaak, is idempotent on redelivery, and is rejected
once the registration has been decided or withdrawn.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
not
2026-07-20 09:41:29 +02:00
co-authored by Claude Opus 4.8
parent 67a60e7f63
commit f39ec2afa3
@@ -294,4 +294,63 @@ public class RegistrationTests
Assert.Contains("only an INGEDIEND", ex.Message);
Assert.Equal(RegistrationStatus.Afgewezen, registration.Status);
}
[Fact]
public void Expiring_an_ingediend_registration_sets_it_verlopen()
{
// The 30-day document-wait timer fired before the documents arrived (S-10a): the case is
// cancelled and the aggregate becomes terminal VERLOPEN.
var registration = Registration.Submit("123456782");
registration.Expire();
Assert.Equal(RegistrationStatus.Verlopen, registration.Status);
}
[Fact]
public void Expiring_needs_no_zaak()
{
// The timer fires on a purely time-based boundary; expiry does not depend on the zaak.
var registration = Registration.Submit("123456782");
registration.Expire();
Assert.Equal(RegistrationStatus.Verlopen, registration.Status);
Assert.Null(registration.ZaakUrl);
}
[Fact]
public void Re_expiring_an_already_verlopen_registration_is_idempotent()
{
// The RegistratieVerlopen worker job may be redelivered (§8.6); re-expiring is a no-op.
var registration = Registration.Submit("123456782");
registration.Expire();
registration.Expire();
Assert.Equal(RegistrationStatus.Verlopen, registration.Status);
}
[Fact]
public void Expiring_an_approved_registration_is_rejected()
{
var registration = Registration.Submit("123456782");
registration.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/abc"));
registration.Approve();
var ex = Assert.Throws<InvalidOperationException>(() => registration.Expire());
Assert.Contains("only an INGEDIEND", ex.Message);
Assert.Equal(RegistrationStatus.Ingeschreven, registration.Status);
}
[Fact]
public void Expiring_a_withdrawn_registration_is_rejected()
{
var registration = Registration.Submit("123456782");
registration.Withdraw();
var ex = Assert.Throws<InvalidOperationException>(() => registration.Expire());
Assert.Contains("only an INGEDIEND", ex.Message);
Assert.Equal(RegistrationStatus.Ingetrokken, registration.Status);
}
}