All checks were successful
## What & why First sub-slice of **S-12 (#13)** — the **beoordeling decision model** in the Domain Service. Foundation for the behandel-portal: it gives the domain a proper decision lifecycle before any UI/Flowable/BFF work. - **Statuses:** add `InBehandeling` and `Afgewezen` to `RegistrationStatus`. - **Aggregate:** `TakeIntoBehandeling()` (`Ingediend → InBehandeling`, idempotent, guards terminal states); generalise the behandelaar decision — `Approve()` (requires a zaak) and new `Reject()` both act on an `Ingediend`/`InBehandeling` registration → `Ingeschreven`/`Afgewezen`. - **Use-case:** `BeoordeelRegistratie` (`goedkeuren` sets the zaak's final status via the ACL §8.1 → `Ingeschreven`; `afwijzen` → `Afgewezen`, domain-only for now). Idempotent. - **Endpoint:** `POST /registrations/{id}/decide` (`{ "besluit": "goedkeuren" | "afwijzen" }`), superseding the temporary `/approve` (retired when the portal lands, S-12d). - **BDD:** `EenRegistratieBeoordelen.feature` — goedkeuren + afwijzen scenarios (feature-scoped bindings). **Scoped out** to later S-12 sub-slices: Flowable user-task claim/complete + BPMN `userTask` (S-12b), BFF `/behandel/*` + medewerker authz (S-12c), the Angular behandel-portal + e2e (S-12d), and propagating a *rejection* to the zaak/projection via the ACL. ## Definition of Done - [x] Linked issue: #13 (umbrella; this PR `refs`, does not close) - [x] Tests first; red → green per behaviour - [x] Unit + acceptance green (`make unit`): domain 65, acceptance 9 - [x] Mutation ≥ break(90): domain 98.77%, no survivors in new code (the one unkilled mutant is the pre-existing `FlowableWorkflowClient` baseline) - [ ] CI green (pending) Part of #13. Reviewed-on: #82
59 lines
2.3 KiB
C#
59 lines
2.3 KiB
C#
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);
|
|
}
|