rebus-org / Rebus.TestHelpers

:bus: Test helpers for Rebus (i.e. fake bus, saga fixture, etc.)
https://mookid.dk/category/rebus
Other
4 stars 2 forks source link

Added IEnumerable<HandlerException>.ThrowIfNotEmpty extension method #6

Closed mclausen closed 2 years ago

mclausen commented 2 years ago

It can sometimes be hard to figure out whether your unit tests for SagaFixtures fails due to an exception happening inside a Rebus Saga.

To help creating leaner unit test I've added an extension method to throw exceptions happening inside the the Saga. I've found myself copying this extension into all my Rebus projects, and thought somebody else could use it as well. Cheers 🍻

Example of how it is used:

using (var fixture = SagaFixture.For( () => _sut))
{
     fixture.Deliver(...);
     fixture.HandlerExceptions.ThrowIfNotEmpty();
 } 

Rebus is MIT-licensed. The code submitted in this pull request needs to carry the MIT license too. By leaving this text in, I hereby acknowledge that the code submitted in the pull request has the MIT license and can be merged with the Rebus codebase.

mookid8000 commented 2 years ago

Cool 🙂 it's out as Rebus.TestHelpers 6.1.2 and should be visible on on NuGet.org in a few minutes.