NServiceBus unit testing ConfigureHowToFindSaga

141 views Asked by At

I would like to test ConfigureHowToFindSaga method in my NServiceBus Saga. Just had what seems like an avoidable issue where I'd forgotten to put the Unique attribute on Saga Data.

I could use Moq or similar but it awkward to verify the unique constraints on the Saga.

Thanks.

2

There are 2 answers

0
Dave Cluderay On

Based on what I read here, I don't think NServiceBus 5 provides anything out of the box to test this method.

0
Hadi Eskandari On

You can always use a convention test, to ensure all your ContainSagaData derived classes have at least one property with [Unique] attribute.

As this doesn't prove that the saga behaves correctly, the way to test the behavior is explained in details here.