var startCommand = CreateScheduleTenderCommand(); await InputQueueSendEndpoint.Send(startCommand);
var foundSagaId = await ShouldContainSaga(startCommand.Email, _saga.State1);
await Bus.Publish(new EventA(instance.ManagementTaskId); await ShouldContainSaga(startCommand.TenderEmail, _saga.State2);
await Bus.Publish(new EventB(instance.ManagementTaskId); await ShouldContainSaga(startCommand.TenderEmail, _saga.State3);
await Bus.Publish(new EventC(instance.ManagementTaskId); await ShouldContainSaga(startCommand.TenderEmail, _saga.State4);
// -> Ok, now I'm in the state that I want to test, so I write me test code below....
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/b8388440-1fe1-41f8-9e36-59347f01010b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You could just create the saga instance matching the correlationId and add it to the in memory repository. But generally I walk the sagas through the events leading up to the subject area for testing as well.
On Sun, Jan 22, 2017 at 7:21 AM, Carmine <carmine...@gmail.com> wrote:
Hi,I'm writing a saga with 7 states and I want to create unit tests in order to test all the stuff.Do you have any example of this? I studied the source code tests and I've already written some ones but I can't find an easy way to transition the saga state directly in a state that I want to test.Right now, I'm writing tests like:var startCommand = CreateScheduleTenderCommand();await InputQueueSendEndpoint.Send(startCommand);var foundSagaId = await ShouldContainSaga(startCommand.Email, _saga.State1);
await Bus.Publish(new EventA(instance.ManagementTaskId);await ShouldContainSaga(startCommand.TenderEmail, _saga.State2);await Bus.Publish(new EventB(instance.ManagementTaskId);await ShouldContainSaga(startCommand.TenderEmail, _saga.State3);await Bus.Publish(new EventC(instance.ManagementTaskId);await ShouldContainSaga(startCommand.TenderEmail, _saga.State4);
// -> Ok, now I'm in the state that I want to test, so I write me test code below....This approach works, but I think that there is another way to do this, right?Thanks
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.