test(domain): acceptance scenario for submitting a registration (refs #6)
Use-case-level BDD (Reqnroll) for S-05: a zorgprofessional submits a registration; the Domain Service starts the registratie process and the OpenZaakAanmaken external task opens a zaak via the ACL, recorded on the aggregate (ADR-0009). Driven against in-memory Workflow Client and ACL stand-ins; real Flowable+ACL+OpenZaak delivery is the live-stack verify-domain check. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
50
tests/acceptance/Support/InMemoryDomainPorts.cs
Normal file
50
tests/acceptance/Support/InMemoryDomainPorts.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Big.Application;
|
||||
using Big.Domain;
|
||||
|
||||
namespace Acceptance.Support;
|
||||
|
||||
/// <summary>An in-memory Workflow Client for the domain acceptance scenario: it records which
|
||||
/// registration a process was started for and returns a fixed instance id. The acceptance test
|
||||
/// drives the use case without a running Flowable (live verification is the verify-domain check).</summary>
|
||||
public sealed class InMemoryWorkflowClient : IWorkflowClient
|
||||
{
|
||||
public const string StartedProcessInstanceId = "proc-acc-1";
|
||||
|
||||
public RegistrationId? StartedFor { get; private set; }
|
||||
|
||||
public Task<string> StartRegistrationProcessAsync(RegistrationId registrationId, CancellationToken ct = default)
|
||||
{
|
||||
StartedFor = registrationId;
|
||||
return Task.FromResult(StartedProcessInstanceId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>An in-memory ACL stand-in: records the bsn it opened a zaak for and returns a fixed URL,
|
||||
/// so the scenario verifies the domain crosses the ACL boundary (§8.1) without a running OpenZaak.</summary>
|
||||
public sealed class InMemoryAclClient : IAclClient
|
||||
{
|
||||
public static readonly Uri OpenedZaakUrl = new("http://openzaak/zaken/api/v1/zaken/acc-zaak");
|
||||
|
||||
public string? OpenedForBsn { get; private set; }
|
||||
|
||||
public Task<Uri> OpenZaakAsync(string bsn, CancellationToken ct = default)
|
||||
{
|
||||
OpenedForBsn = bsn;
|
||||
return Task.FromResult(OpenedZaakUrl);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>An in-memory registration store for the domain acceptance scenario.</summary>
|
||||
public sealed class InMemoryRegistrationStore : IRegistrationStore
|
||||
{
|
||||
private readonly Dictionary<RegistrationId, Registration> _byId = [];
|
||||
|
||||
public Task SaveAsync(Registration registration, CancellationToken ct = default)
|
||||
{
|
||||
_byId[registration.Id] = registration;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task<Registration?> GetAsync(RegistrationId id, CancellationToken ct = default)
|
||||
=> Task.FromResult(_byId.GetValueOrDefault(id));
|
||||
}
|
||||
Reference in New Issue
Block a user