[rabbitmq-discuss] [dotnet-client] Help mocking IModel.BasicPublish

Mark Snelling mark at bakedbeans.com
Fri May 24 17:02:12 BST 2013


Hello,

I'm writing unit tests for the various components in my application, some 
of which interface with a RabbitMQ broker.

I've managed to successfully implement reading from a mocked call to 
IModel.BasicConsume() and acknowledging with IModel.BasicAck() but am stuck 
on IModel.BasicPublish(), in particular mocking the ack/nack mechanism with 
IModel as I need to test my component in both those scenarios.

How does the ack/nack mechanism work with IModel.WaitForConfirms() and how 
would I go about sending an ack/nack when the publisher calls 
IModel.BasicPublish()?

I'm using NSubstitute as my mocking library but I imagine the solution 
is translatable across mocking frameworks.

Thanks,

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130524/de1420f5/attachment.htm>


More information about the rabbitmq-discuss mailing list