Reputation: 301
Is there anyway to let rebus publish all message synchronously so that I can assert on some value after all message have been processed?
Or what is the best way to do an integration test:
Thanks
Regards
Yin
Upvotes: 1
Views: 462
Reputation: 18628
For testing a single saga and its behavior you should take a look at the blog post I wrote, Unit testing sagas with Rebus, which is an example on how SagaFixture
and FakeBus
can be used - I think it supports everything you're mentioning that you want to test.
If you're interested in testing more complicated scenarios, possibly involving other handlers and longer message correspondences etc, you might benefit from some strategic use of ManualResetEvent
- Rebus has several integration tests that start up a bus and do some stuff, doing a resetEvent.Set()
when the scenario is over - this way, the test can do a resetEvent.WaitOne(timeout)
to block while the test is running and continue immediately when it's over.
Upvotes: 1