public async Task Try() { var persister = new InMemorySagaPersister(); var inbox = new InMemoryInbox(); var dispatcher = new FakeDispatcher(); var manager = new SagaManager(persister, inbox, dispatcher); await manager.Process <SagaData>("messageId", "correlationId", new ContextBag(), HandlerCallback); var dataContainer = await persister.LoadByCorrelationId("correlationId"); var sagaData = (SagaData)dataContainer.SagaData; Assert.AreEqual(1, sagaData.Counter); }
async Task ProcessMessage(SagaManager managerA, TestController testController) { var completed = false; while (!completed) { try { await managerA.Process <SagaData>("messageId", "correlationId", new ContextBag(), HandlerCallback); completed = true; testController.Complete(); } catch (ConcurrencyException e) { //Swallow and retry } catch (Exception e) { Console.WriteLine(e.Message); } } }