public void ShouldThrowExceptionWhenExchangeNotExists() { // Given var commandExecutor = new Mock <IMessageQueueCommandExecutor>(); var workerContainer = new Mock <IMessageQueueWorkerContainer>(); // When var target = new MessageQueueManager(commandExecutor.Object, workerContainer.Object); TestDelegate exchangeFanoutNotExists = () => target.GetExchangeFanout(ExchangeName); TestDelegate exchangeDirectNotExists = () => target.GetExchangeDirect(ExchangeName); TestDelegate exchangeTopicNotExists = () => target.GetExchangeTopic(ExchangeName); TestDelegate exchangeHeadersNotExists = () => target.GetExchangeHeaders(ExchangeName); // Then Assert.Throws <InvalidOperationException>(exchangeFanoutNotExists); Assert.Throws <InvalidOperationException>(exchangeDirectNotExists); Assert.Throws <InvalidOperationException>(exchangeTopicNotExists); Assert.Throws <InvalidOperationException>(exchangeHeadersNotExists); }