test(domain): Registration aggregate invariants (refs #6)
Failing unit tests for the Registration aggregate root: a submission starts in INGEDIEND carrying its bsn, an empty/whitespace/null bsn is rejected, the started process-instance id is remembered, and attaching the zaak the ACL opened records its URL idempotently (a conflicting URL is rejected) while the status stays INGEDIEND. The aggregate is a stub (no-op mutators, empty bsn) so the tests compile and fail on their assertions; the green commit implements the invariants. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
47
services/domain/Big.Domain/Registration.cs
Normal file
47
services/domain/Big.Domain/Registration.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
namespace Big.Domain;
|
||||
|
||||
/// <summary>
|
||||
/// The Registration aggregate root (CLAUDE.md §2.2): a zorgprofessional's submission to the BIG
|
||||
/// register. It owns its lifecycle invariants — it starts <see cref="RegistrationStatus.Ingediend"/>
|
||||
/// on submission, remembers the Flowable process that drives it, and records the zaak the ACL opens.
|
||||
/// </summary>
|
||||
public sealed class Registration
|
||||
{
|
||||
// STUB (red): mutators are no-ops and Submit leaves the bsn empty so the behaviour tests
|
||||
// compile and fail on their assertions. The green commit implements the invariants.
|
||||
private Registration(RegistrationId id, string bsn)
|
||||
{
|
||||
Id = id;
|
||||
Bsn = bsn;
|
||||
Status = RegistrationStatus.Ingediend;
|
||||
}
|
||||
|
||||
public RegistrationId Id { get; }
|
||||
|
||||
/// <summary>The citizen-service number of the submitting zorgprofessional. Handed to the ACL
|
||||
/// as the domain payload; the domain never constructs ZGW concepts from it (§8.1).</summary>
|
||||
public string Bsn { get; }
|
||||
|
||||
public RegistrationStatus Status { get; private set; }
|
||||
|
||||
/// <summary>The Flowable process instance driving this registration, once started.</summary>
|
||||
public string? ProcessInstanceId { get; private set; }
|
||||
|
||||
/// <summary>The zaak the ACL opened for this registration, once the external task has run.</summary>
|
||||
public Uri? ZaakUrl { get; private set; }
|
||||
|
||||
/// <summary>Submit a new registration. It begins in <see cref="RegistrationStatus.Ingediend"/>.</summary>
|
||||
public static Registration Submit(string bsn) => new(RegistrationId.New(), string.Empty);
|
||||
|
||||
/// <summary>Record that the registratie workflow process has been started for this registration.</summary>
|
||||
public void RecordProcessStarted(string processInstanceId)
|
||||
{
|
||||
// STUB (red).
|
||||
}
|
||||
|
||||
/// <summary>Attach the zaak the ACL opened. Idempotent on the same URL; a conflicting URL is rejected.</summary>
|
||||
public void AttachZaak(Uri zaakUrl)
|
||||
{
|
||||
// STUB (red).
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user