test(acceptance): beoordeling scenario — goedkeuren via ACL, afwijzen (refs #13)
BDD scenarios (Gherkin/Reqnroll) driving S-12's decide flow: a behandelaar takes an INGEDIEND registration into behandeling and decides it goedkeuren (→ INGESCHREVEN, zaak status via the ACL) or afwijzen (→ AFGEWEZEN, no ACL). Feature-scoped bindings avoid clashing with the identically-phrased status step in RegistratieIndienen. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
58
tests/acceptance/Steps/EenRegistratieBeoordelenSteps.cs
Normal file
58
tests/acceptance/Steps/EenRegistratieBeoordelenSteps.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using Acceptance.Support;
|
||||
using Big.Application;
|
||||
using Big.Domain;
|
||||
using Reqnroll;
|
||||
using Xunit;
|
||||
|
||||
namespace Acceptance.Steps;
|
||||
|
||||
/// <summary>Bindings for <c>EenRegistratieBeoordelen.feature</c> (S-12). Drives the TakeIntoBehandeling
|
||||
/// transition and the BeoordeelRegistratie use case against in-memory ports; one instance per scenario.
|
||||
/// Scoped to this feature so its "the registration has status" step does not clash with the identically
|
||||
/// phrased (but differently-asserting) step in <see cref="RegistratieIndienenSteps"/>.</summary>
|
||||
[Binding]
|
||||
[Scope(Feature = "Een registratie beoordelen")]
|
||||
public sealed class EenRegistratieBeoordelenSteps
|
||||
{
|
||||
private readonly InMemoryAclClient _acl = new();
|
||||
private readonly InMemoryRegistrationStore _store = new();
|
||||
private RegistrationId _id;
|
||||
|
||||
[Given("a submitted registration with an opened zaak")]
|
||||
public async Task GivenASubmittedRegistrationWithAnOpenedZaak()
|
||||
{
|
||||
var registration = Registration.Submit("123456782");
|
||||
registration.AttachZaak(InMemoryAclClient.OpenedZaakUrl);
|
||||
await _store.SaveAsync(registration);
|
||||
_id = registration.Id;
|
||||
}
|
||||
|
||||
[When("the behandelaar takes it into behandeling")]
|
||||
public async Task WhenTheBehandelaarTakesItIntoBehandeling()
|
||||
{
|
||||
var registration = await _store.GetAsync(_id);
|
||||
registration!.TakeIntoBehandeling();
|
||||
await _store.SaveAsync(registration);
|
||||
}
|
||||
|
||||
[When("the behandelaar decides \"(.*)\"")]
|
||||
public async Task WhenTheBehandelaarDecides(string besluit)
|
||||
=> await new BeoordeelRegistratie(_store, _acl).HandleAsync(
|
||||
new BeoordeelRegistratieCommand(_id, Enum.Parse<BeoordelingsBesluit>(besluit, ignoreCase: true)));
|
||||
|
||||
[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());
|
||||
}
|
||||
|
||||
[Then("the zaak's final status is set via the ACL")]
|
||||
public void ThenTheZaakFinalStatusIsSetViaTheAcl()
|
||||
=> Assert.Equal(InMemoryAclClient.OpenedZaakUrl, _acl.ApprovedZaakUrl);
|
||||
|
||||
[Then("the ACL is not asked to set the zaak status")]
|
||||
public void ThenTheAclIsNotAskedToSetTheZaakStatus()
|
||||
=> Assert.Null(_acl.ApprovedZaakUrl);
|
||||
}
|
||||
Reference in New Issue
Block a user