test(domain): approving a registration advances INGEDIEND → INGESCHREVEN (refs #75)
Guards: an opened zaak is required and only a submitted registration can be approved. Fails to compile — Registration.Approve() and RegistrationStatus. Ingeschreven don't exist yet (red). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -87,4 +87,37 @@ public class RegistrationTests
|
|||||||
Assert.Contains("/zaken/abc", ex.Message);
|
Assert.Contains("/zaken/abc", ex.Message);
|
||||||
Assert.Contains("/zaken/other", ex.Message);
|
Assert.Contains("/zaken/other", ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Approving_a_registration_with_a_zaak_sets_it_ingeschreven()
|
||||||
|
{
|
||||||
|
var registration = Registration.Submit("123456782");
|
||||||
|
registration.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/abc"));
|
||||||
|
|
||||||
|
registration.Approve();
|
||||||
|
|
||||||
|
Assert.Equal(RegistrationStatus.Ingeschreven, registration.Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Approving_before_the_zaak_is_opened_is_rejected()
|
||||||
|
{
|
||||||
|
var registration = Registration.Submit("123456782");
|
||||||
|
|
||||||
|
var ex = Assert.Throws<InvalidOperationException>(() => registration.Approve());
|
||||||
|
|
||||||
|
Assert.Contains("no zaak", ex.Message, StringComparison.OrdinalIgnoreCase);
|
||||||
|
Assert.Equal(RegistrationStatus.Ingediend, registration.Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Approving_an_already_ingeschreven_registration_is_rejected()
|
||||||
|
{
|
||||||
|
var registration = Registration.Submit("123456782");
|
||||||
|
registration.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/abc"));
|
||||||
|
registration.Approve();
|
||||||
|
|
||||||
|
Assert.Throws<InvalidOperationException>(() => registration.Approve());
|
||||||
|
Assert.Equal(RegistrationStatus.Ingeschreven, registration.Status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user