Testing Azure dead letter service bus queues
azure, azureservicebus, integration-testing
Solution
In Service Bus API, Microsoft doesn't provide ability to send message to dead letter queue straight away without putting message to the main queue. If you try to create MessageSender using path to dead letter queue, it will fail with exception.
You need to mock out your main queue receiver with fake implementation that invokes BrokeredMessage.DeadLetter() method that transfers message to dead letter queue.
Problem
We have a service which listens to a Azure service bus queue. We have another service which listens to the dead letter queue of this queue. We also have a series of tests which run against our Azure application when it has have been deployed. We would like to extend our automated tests so that the parts that deal with the dead letters are also tested, but are not sure how we can write tests which will ensure that messages get to the dead letter queue, as under normal circumstances messages will not dead letter. currently we are testing this manually, but I feel like this is not a long term option. any ideas?