using Big.Application;
using Big.Domain;
namespace Acceptance.Support;
/// An in-memory Workflow Client for the domain acceptance scenario: it records which
/// registration a process was started for and returns a fixed instance id. The acceptance test
/// drives the use case without a running Flowable (live verification is the verify-domain check).
public sealed class InMemoryWorkflowClient : IWorkflowClient
{
public const string StartedProcessInstanceId = "proc-acc-1";
public RegistrationId? StartedFor { get; private set; }
public Task StartRegistrationProcessAsync(RegistrationId registrationId, CancellationToken ct = default)
{
StartedFor = registrationId;
return Task.FromResult(StartedProcessInstanceId);
}
}
/// An in-memory ACL stand-in: records the bsn it opened a zaak for and returns a fixed URL,
/// so the scenario verifies the domain crosses the ACL boundary (ยง8.1) without a running OpenZaak.
public sealed class InMemoryAclClient : IAclClient
{
public static readonly Uri OpenedZaakUrl = new("http://openzaak/zaken/api/v1/zaken/acc-zaak");
public string? OpenedForBsn { get; private set; }
public Task OpenZaakAsync(string bsn, CancellationToken ct = default)
{
OpenedForBsn = bsn;
return Task.FromResult(OpenedZaakUrl);
}
}
/// An in-memory registration store for the domain acceptance scenario.
public sealed class InMemoryRegistrationStore : IRegistrationStore
{
private readonly Dictionary _byId = [];
public Task SaveAsync(Registration registration, CancellationToken ct = default)
{
_byId[registration.Id] = registration;
return Task.CompletedTask;
}
public Task GetAsync(RegistrationId id, CancellationToken ct = default)
=> Task.FromResult(_byId.GetValueOrDefault(id));
}