test(acceptance): document-termijn verloopt (both branches) (refs #102)
BDD for S-10a: a registration parked at WachtOpDocumenten expires to VERLOPEN when the 30-day timer fires, and does NOT expire when documents arrive first. Drives the real RegistratieVerlopenProcessor + ExpireRegistrationWorker against an in-memory Flowable stand-in, mirroring the escalation feature. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using Acceptance.Support;
|
||||
using Big.Application;
|
||||
using Big.Domain;
|
||||
using Big.Infrastructure;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Reqnroll;
|
||||
using Xunit;
|
||||
|
||||
namespace Acceptance.Steps;
|
||||
|
||||
/// <summary>Bindings for <c>EenDocumentTermijnVerlopen.feature</c> (S-10a). Drives the timeout worker
|
||||
/// (<see cref="RegistratieVerlopenProcessor"/> over the <see cref="ExpireRegistrationWorker"/>) against
|
||||
/// an in-memory Flowable stand-in and a shared registration store; one instance per scenario. The
|
||||
/// interrupting 30-day timer either cancels the wait and expires the registration, or — if the
|
||||
/// documents arrived first — never fires; the scenario asserts on the aggregate's status.</summary>
|
||||
[Binding]
|
||||
[Scope(Feature = "Een documenttermijn laten verlopen")]
|
||||
public sealed class EenDocumentTermijnVerlopenSteps
|
||||
{
|
||||
private readonly InMemoryDocumentTimeoutClient _flowable = new();
|
||||
private readonly Support.InMemoryRegistrationStore _store = new();
|
||||
private Registration _registration = null!;
|
||||
private string _processInstanceId = "";
|
||||
|
||||
[Given("a registration parked at the WachtOpDocumenten task")]
|
||||
public async Task GivenARegistrationParkedAtWachtOpDocumenten()
|
||||
{
|
||||
_registration = Registration.Submit("123456782");
|
||||
await _store.SaveAsync(_registration);
|
||||
_processInstanceId = _flowable.ParkWaitingForDocuments(_registration.Id);
|
||||
}
|
||||
|
||||
[When("the 30-day document timer fires")]
|
||||
public void WhenTheDocumentTimerFires() => _flowable.FireDocumentTimer(_processInstanceId);
|
||||
|
||||
[When("the documents arrive before the timer fires")]
|
||||
public void WhenTheDocumentsArriveBeforeTheTimer() => _flowable.ReceiveDocuments(_processInstanceId);
|
||||
|
||||
[When("the document-timeout worker runs")]
|
||||
public async Task WhenTheTimeoutWorkerRuns()
|
||||
=> await new RegistratieVerlopenProcessor(
|
||||
_flowable, new ExpireRegistrationWorker(_store),
|
||||
NullLogger<RegistratieVerlopenProcessor>.Instance).PumpOnceAsync(5);
|
||||
|
||||
[Then("the registration is verlopen")]
|
||||
public async Task ThenTheRegistrationIsVerlopen()
|
||||
=> Assert.Equal(RegistrationStatus.Verlopen, (await _store.GetAsync(_registration.Id))!.Status);
|
||||
|
||||
[Then("the registration is not verlopen")]
|
||||
public async Task ThenTheRegistrationIsNotVerlopen()
|
||||
=> Assert.Equal(RegistrationStatus.Ingediend, (await _store.GetAsync(_registration.Id))!.Status);
|
||||
}
|
||||
Reference in New Issue
Block a user