From ddebfd371a83a897a30bbd7e6e370023bafce961 Mon Sep 17 00:00:00 2001 From: Niek Otten Date: Tue, 14 Jul 2026 17:24:46 +0200 Subject: [PATCH] =?UTF-8?q?test(acceptance):=20beoordeling=20scenario=20?= =?UTF-8?q?=E2=80=94=20goedkeuren=20via=20ACL,=20afwijzen=20(refs=20#13)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../Features/EenRegistratieBeoordelen.feature | 24 ++++++++ .../Steps/EenRegistratieBeoordelenSteps.cs | 58 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 tests/acceptance/Features/EenRegistratieBeoordelen.feature create mode 100644 tests/acceptance/Steps/EenRegistratieBeoordelenSteps.cs diff --git a/tests/acceptance/Features/EenRegistratieBeoordelen.feature b/tests/acceptance/Features/EenRegistratieBeoordelen.feature new file mode 100644 index 0000000..7c94fa6 --- /dev/null +++ b/tests/acceptance/Features/EenRegistratieBeoordelen.feature @@ -0,0 +1,24 @@ +# language: en +# Drives S-12 (#13). A behandelaar picks up a submitted registration for beoordeling and decides it: +# goedkeuren enters it in the register (INGESCHREVEN, the zaak's final status set via the ACL, §8.1), +# afwijzen turns it down (AFGEWEZEN). This scenario exercises the use cases against in-memory +# stand-ins for the ACL and the store; real Flowable user-task claim/complete arrives in a later +# sub-slice and is verified live. +Feature: Een registratie beoordelen + Als behandelaar wil ik een ingediende registratie beoordelen + zodat deze wordt ingeschreven of afgewezen. + + Scenario: Goedkeuren schrijft de registratie in via de ACL + Given a submitted registration with an opened zaak + When the behandelaar takes it into behandeling + Then the registration has status "INBEHANDELING" + When the behandelaar decides "goedkeuren" + Then the registration has status "INGESCHREVEN" + And the zaak's final status is set via the ACL + + Scenario: Afwijzen wijst de registratie af zonder de ACL + Given a submitted registration with an opened zaak + When the behandelaar takes it into behandeling + And the behandelaar decides "afwijzen" + Then the registration has status "AFGEWEZEN" + And the ACL is not asked to set the zaak status diff --git a/tests/acceptance/Steps/EenRegistratieBeoordelenSteps.cs b/tests/acceptance/Steps/EenRegistratieBeoordelenSteps.cs new file mode 100644 index 0000000..181951d --- /dev/null +++ b/tests/acceptance/Steps/EenRegistratieBeoordelenSteps.cs @@ -0,0 +1,58 @@ +using Acceptance.Support; +using Big.Application; +using Big.Domain; +using Reqnroll; +using Xunit; + +namespace Acceptance.Steps; + +/// Bindings for EenRegistratieBeoordelen.feature (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 . +[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(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); +}