I am attempting to write unit tests for my NServiceBus(version 5) message handlers. I am using RabbitMQ and the Outbox feature.
The Outbox feature gives you "DTC" like functionality, HOWEVER, this is achieved by injecting a NHibernateStorageContext into your handler. Any DB changes you make, MUST be done using the database connection from that object. (i.e. all DB writes must occur via the same database connection/transaction).
The problem I am running into is that NHibernateStorageContext does not have a public default constructor. Plus, it does not implement any interfaces! There is no way for me to mock it and pass it in using standard frameworks like MOQ.
At this point, the only solution I can come up with is to use MS Fakes, generate a Fake of the class and pass it down.
Am I missing something? Is there an easier way to do this?