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>
55 lines
2.2 KiB
C#
55 lines
2.2 KiB
C#
using Acceptance.Support;
|
|
using Big.Application;
|
|
using Big.Domain;
|
|
using Reqnroll;
|
|
using Xunit;
|
|
|
|
namespace Acceptance.Steps;
|
|
|
|
/// <summary>Bindings for <c>RegistratieIndienen.feature</c> (S-05). Drives the SubmitRegistration
|
|
/// and OpenZaakWorker use cases against in-memory ports; one instance per scenario.</summary>
|
|
[Binding]
|
|
public sealed class RegistratieIndienenSteps
|
|
{
|
|
private readonly InMemoryWorkflowClient _workflow = new();
|
|
private readonly InMemoryAclClient _acl = new();
|
|
private readonly InMemoryRegistrationStore _store = new();
|
|
private string _bsn = "";
|
|
private RegistrationId _id;
|
|
|
|
[Given("a zorgprofessional submits a registration for BSN \"(.*)\"")]
|
|
public void GivenAZorgprofessionalSubmitsARegistration(string bsn) => _bsn = bsn;
|
|
|
|
[When("the domain service handles the submission")]
|
|
public async Task WhenTheDomainServiceHandlesTheSubmission()
|
|
=> _id = await new SubmitRegistration(_store, _workflow).HandleAsync(new SubmitRegistrationCommand(_bsn));
|
|
|
|
[Then("a registratie process is started for the registration")]
|
|
public void ThenARegistratieProcessIsStarted()
|
|
=> Assert.Equal(_id, _workflow.StartedFor);
|
|
|
|
[Then("the registration has status \"(.*)\"")]
|
|
public async Task ThenTheRegistrationHasStatus(string expected)
|
|
{
|
|
var registration = await _store.GetAsync(_id);
|
|
Assert.NotNull(registration);
|
|
Assert.Equal(expected, registration.Status.ToString().ToUpperInvariant());
|
|
Assert.Equal(InMemoryWorkflowClient.StartedProcessInstanceId, registration.ProcessInstanceId);
|
|
}
|
|
|
|
[When("the OpenZaakAanmaken external task is handled for the registration")]
|
|
public async Task WhenTheExternalTaskIsHandled()
|
|
=> await new OpenZaakWorker(_store, _acl).HandleAsync(new OpenZaakJob("job-acc-1", _id));
|
|
|
|
[Then("a zaak is opened via the ACL for BSN \"(.*)\"")]
|
|
public void ThenAZaakIsOpenedViaTheAcl(string bsn)
|
|
=> Assert.Equal(bsn, _acl.OpenedForBsn);
|
|
|
|
[Then("the zaak is recorded on the registration")]
|
|
public async Task ThenTheZaakIsRecordedOnTheRegistration()
|
|
{
|
|
var registration = await _store.GetAsync(_id);
|
|
Assert.Equal(InMemoryAclClient.OpenedZaakUrl, registration!.ZaakUrl);
|
|
}
|
|
}
|