Stryker.NET config for the domain service (break 90, the repo's ratchet floor), excluding the OpenZaakJobPump hosted-shell from mutation. Hardened the unit tests to kill survivors — Basic-credential value, variable types, null/failure response paths, option defaults, guard clauses, save counts and log output — leaving only two documented equivalent mutants (Stryker-disabled). make mutation runs the domain ratchet and CI uploads its report alongside the others. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
91 lines
2.8 KiB
C#
91 lines
2.8 KiB
C#
using Big.Domain;
|
|
|
|
namespace Big.Tests;
|
|
|
|
public class RegistrationTests
|
|
{
|
|
[Fact]
|
|
public void Submitting_a_registration_starts_in_ingediend()
|
|
{
|
|
var registration = Registration.Submit("123456782");
|
|
|
|
Assert.Equal(RegistrationStatus.Ingediend, registration.Status);
|
|
Assert.Equal("123456782", registration.Bsn);
|
|
Assert.NotEqual(Guid.Empty, registration.Id.Value);
|
|
Assert.Null(registration.ZaakUrl);
|
|
Assert.Null(registration.ProcessInstanceId);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("")]
|
|
[InlineData(" ")]
|
|
[InlineData(null)]
|
|
public void Submitting_without_a_bsn_is_rejected(string? bsn)
|
|
=> Assert.ThrowsAny<ArgumentException>(() => Registration.Submit(bsn!));
|
|
|
|
[Fact]
|
|
public void Recording_the_started_process_keeps_its_instance_id()
|
|
{
|
|
var registration = Registration.Submit("123456782");
|
|
|
|
registration.RecordProcessStarted("proc-42");
|
|
|
|
Assert.Equal("proc-42", registration.ProcessInstanceId);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("")]
|
|
[InlineData(" ")]
|
|
[InlineData(null)]
|
|
public void Recording_an_empty_process_instance_id_is_rejected(string? processInstanceId)
|
|
{
|
|
var registration = Registration.Submit("123456782");
|
|
|
|
Assert.ThrowsAny<ArgumentException>(() => registration.RecordProcessStarted(processInstanceId!));
|
|
}
|
|
|
|
[Fact]
|
|
public void Attaching_a_zaak_records_its_url_and_keeps_the_status_ingediend()
|
|
{
|
|
var registration = Registration.Submit("123456782");
|
|
var zaak = new Uri("http://openzaak/zaken/api/v1/zaken/abc");
|
|
|
|
registration.AttachZaak(zaak);
|
|
|
|
Assert.Equal(zaak, registration.ZaakUrl);
|
|
Assert.Equal(RegistrationStatus.Ingediend, registration.Status);
|
|
}
|
|
|
|
[Fact]
|
|
public void Attaching_a_null_zaak_is_rejected()
|
|
{
|
|
var registration = Registration.Submit("123456782");
|
|
|
|
Assert.Throws<ArgumentNullException>(() => registration.AttachZaak(null!));
|
|
}
|
|
|
|
[Fact]
|
|
public void Re_attaching_the_same_zaak_is_idempotent()
|
|
{
|
|
var registration = Registration.Submit("123456782");
|
|
var zaak = new Uri("http://openzaak/zaken/api/v1/zaken/abc");
|
|
|
|
registration.AttachZaak(zaak);
|
|
registration.AttachZaak(zaak);
|
|
|
|
Assert.Equal(zaak, registration.ZaakUrl);
|
|
}
|
|
|
|
[Fact]
|
|
public void Attaching_a_conflicting_zaak_is_rejected()
|
|
{
|
|
var registration = Registration.Submit("123456782");
|
|
registration.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/abc"));
|
|
|
|
var ex = Assert.Throws<InvalidOperationException>(
|
|
() => registration.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/other")));
|
|
Assert.Contains("/zaken/abc", ex.Message);
|
|
Assert.Contains("/zaken/other", ex.Message);
|
|
}
|
|
}
|