// did the endpoint consume the message
Assert.IsTrue(harness.Consumed.Select<InitialEvent>().Any()); // harness.Consumed is empty !!!!!!!!!!
cfg.ReceiveEndpoint("MyStateMachineQueue", e =>
{ e.StateMachineSaga(machine, repository);
.... });
--
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-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/58d11d2b-9ba2-40e7-8207-21cedebae3f8%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/CAHX4WYcDyQVSa3-KaV9hC3kf1rkbFT2949uJdaF-Evb5u%3DjhoA%40mail.gmail.com.
public async Task Should_test_the_state_machine_saga() { var machine = new MyStateMachine();
var harness = new InMemoryTestHarness(); var sagaHarness = harness.StateMachineSaga<MyInstance, MyStateMachine>(machine);
await harness.Start(); try { Guid sagaId = NewId.NextGuid();
await harness.Bus.Publish(new InitialEventImpl(sagaId));
var test = sagaHarness.Consumed.ToList(); // EMPTY !!!!
// did the endpoint consume the message Assert.IsTrue(harness.Consumed.Select<InitialEvent>().Any());
test = sagaHarness.Consumed.ToList(); // contains 1 Message
// did the actual consumer consume the message Assert.IsTrue(sagaHarness.Consumed.Select<InitialEvent>().Any());
/*MyInstance instance = sagaHarness.Created.ContainsInState(sagaId, machine, machine.Active); Assert.IsNotNull(instance, "Saga instance not found");*/ } finally { await harness.Stop(); } }
--
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-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/90770203-e1c3-4350-8d2b-3a79e93d1d15%40googlegroups.com.
public async Task Should_test_the_state_machine_saga()
{
var machine = new MyStateMachine();
var harness = new InMemoryTestHarness();
var sagaHarness = harness.StateMachineSaga<MyInstance, MyStateMachine>(machine);
await harness.Start();
try
{
Guid sagaId = NewId.NextGuid();
await harness.Bus.Publish(new InitialEvent(sagaId));
// did the endpoint consume the message
Assert.IsTrue(harness.Consumed.Select<InitialEvent>().Any())
;
/* This is important : it not only verifies the assertion,
* but behind the scene it waits until the messages are consumed, this is mandatory to let the saga complete its way
*/
// did the actual consumer consume the message
Assert.IsTrue(sagaHarness.Consumed.Select<InitialEvent>().Any());
MyInstance instance = sagaHarness.Created.ContainsInState(sagaId, machine, machine.Active);
Assert.IsNotNull(instance, "Saga instance not found");
}
finally
{
await harness.Stop();
}
--
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-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/faf24cb5-c754-4e2c-90af-03b84060e4bd%40googlegroups.com.