CI / build (pull_request) Successful in 1m11s
CI / lint (pull_request) Successful in 1m25s
CI / unit (pull_request) Successful in 1m27s
CI / frontend (pull_request) Successful in 3m5s
CI / mutation (pull_request) Successful in 6m7s
CI / verify-stack (pull_request) Failing after 11m42s
For a `resource: object` notification Objecten sends the object as both hoofdObject and resourceUrl — the object *is* the main resource — so `HoofdObject ?? ResourceUrl` was a branch that can never take its left side and that no test could distinguish. It came across from the zaken path, where hoofdObject genuinely differed (the zaak behind a status). Tests unchanged and green.
58 lines
2.4 KiB
C#
58 lines
2.4 KiB
C#
using Acceptance.Support;
|
|
using EventSubscriber.Application;
|
|
using Reqnroll;
|
|
using Xunit;
|
|
|
|
namespace Acceptance.Steps;
|
|
|
|
/// <summary>Bindings for <c>RegisterProjectieBijwerken.feature</c> (S-06, re-sourced by S-19b-2).
|
|
/// Reqnroll creates one instance per scenario, so instance fields hold scenario-scoped state.</summary>
|
|
[Binding]
|
|
public sealed class RegisterProjectieBijwerkenSteps
|
|
{
|
|
private const string ObjectBase = "http://objecten.local:8000/api/v2/objects/";
|
|
|
|
private readonly InMemoryNotificationLog _log = new();
|
|
private readonly InMemoryProjectionStore _store = new();
|
|
private readonly InMemoryRegisterRecordClient _register = new();
|
|
private readonly NotificationProjector _projector;
|
|
private Notification? _notification;
|
|
|
|
public RegisterProjectieBijwerkenSteps()
|
|
=> _projector = new NotificationProjector(_log, _store, _register);
|
|
|
|
[Given("registration \"(.*)\" is recorded in the register with status \"(.*)\"")]
|
|
[When("registration \"(.*)\" is recorded in the register with status \"(.*)\"")]
|
|
public void RegistrationIsRecorded(string id, string status)
|
|
{
|
|
// The ACL upserts one object per registration, so submit and approval share an object URL.
|
|
var objectUrl = ObjectBase + id;
|
|
_register.Records[objectUrl] = new RegisterRecord(id, status, "REG-" + id);
|
|
_notification = new Notification("objecten", "object", "create", new Uri(objectUrl));
|
|
}
|
|
|
|
[Given("the register notification is delivered to the event subscriber")]
|
|
[When("the register notification is delivered to the event subscriber")]
|
|
public Task TheNotificationIsDelivered()
|
|
=> _projector.HandleAsync(_notification!);
|
|
|
|
[When("the same register notification is delivered again")]
|
|
public Task TheSameNotificationIsDeliveredAgain()
|
|
=> _projector.HandleAsync(_notification!);
|
|
|
|
[Then("the register projection contains a row for \"(.*)\" with status \"(.*)\"")]
|
|
public async Task ThenTheProjectionContainsARowWithStatus(string id, string status)
|
|
{
|
|
var entry = Assert.Single(await _store.AllAsync());
|
|
Assert.Equal(id, entry.Id);
|
|
Assert.Equal(status, entry.Status);
|
|
}
|
|
|
|
[Then("the register projection contains exactly one row for \"(.*)\"")]
|
|
public async Task ThenTheProjectionContainsExactlyOneRowFor(string id)
|
|
{
|
|
await _store.AllAsync();
|
|
Assert.Single(_store.RowsFor(id));
|
|
}
|
|
}
|