Ejemplo n.º 1
0
        public void ShouldCreateExchangeTopic()
        {
            // Given
            var session         = new Mock <IMessageQueueSession>();
            var commandExecutor = new Mock <IMessageQueueCommandExecutor>();
            var workerContainer = new Mock <IMessageQueueWorkerContainer>();

            commandExecutor.Setup(m => m.Execute(It.IsAny <Action <IMessageQueueSession> >())).Callback <Action <IMessageQueueSession> >(command => command(session.Object));

            // When
            var target = new MessageQueueManager(commandExecutor.Object, workerContainer.Object);
            var result = target.CreateExchangeTopic(ExchangeName);

            // Then
            Assert.IsNotNull(result);
            session.Verify(m => m.CreateExchangeTopic(It.Is <ExchangeConfig>(p => p.ExchangeName == ExchangeName)));
        }