feat(workflow): document-wait task + 30-day timeout cancellation (S-10a, closes #102) #105
@@ -48,6 +48,25 @@ public class ExpireRegistrationWorkerTests
|
||||
Assert.Equal(RegistrationStatus.Verlopen, (await store.GetAsync(registration.Id))!.Status);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task An_already_resolved_registration_is_left_alone_and_the_job_completes()
|
||||
{
|
||||
// Race with S-11: the citizen withdrew while parked at WachtOpDocumenten, so the aggregate is
|
||||
// already terminal (INGETROKKEN) when the timer's job arrives. Expiring it would violate the
|
||||
// aggregate's invariant; the worker must instead no-op (and let the job complete), not throw
|
||||
// into a redelivery loop.
|
||||
var store = new FakeRegistrationStore();
|
||||
var registration = Submitted();
|
||||
registration.Withdraw();
|
||||
store.Seed(registration);
|
||||
|
||||
await new ExpireRegistrationWorker(store).HandleAsync(
|
||||
new RegistratieVerlopenJob("job-7", registration.Id));
|
||||
|
||||
Assert.Equal(0, store.SaveCount);
|
||||
Assert.Equal(RegistrationStatus.Ingetrokken, (await store.GetAsync(registration.Id))!.Status);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task An_unknown_registration_throws_so_the_job_is_redelivered()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user