Closed pblachut closed 7 years ago
I would not consider this as any thing related to the persistence. If you want to test your saga - you need to use test harnesses provided by MassTransit.
@pblachut if you want to preinitialize your saga in integration test then you probably have to publish your messages through MT. This will add events to your saga repository stream.
Regarding point no 2: I publish message on the bus which which should generate transition to state 2. It`s integration test and saga is not the only thing.
This is how you test Automatonymous sagas: https://github.com/MassTransit/MassTransit/blob/develop/src/MassTransit.AutomatonymousIntegration.Tests/Testing_Specs.cs
But you do not need to test with persistence unless you absolutely need to, this will involve embedded ES and it will become too slow. In-memory persistence is just fine to test the saga logic.
But looking at your initial post again (sorry I was reading from mobile) I can conclude that the stream name does not match, you can also check there.
Thanks for your response. Stream name was good, problem is in the state of the bus.
I have changed my test to setup SUT by send all messages on the bus (instead manually persistance saga state to ES). It is not perfect situation (in the test I check handling of two messages) but based on links which you have sent it will be hard to get better results. Thanks!
I wonder if it is possible to persist manually stream of events which will represent a saga instance in specified state?
I try to do some integration tests connected with sagas persisted in ES, here is my scenario:
During publishing of event2 I receive error that event2 is not expected in Initial saga state (like the saga would not exist). I suppose that I`m missing some MT configuration (using RabbitMQ).
Can you give me some advice if such scenario is possible?