Exemplo n.º 1
0
        public async Task StartAsync_CallsMessagingProviderToCreateReceiver()
        {
            MessageReceiver receiver = _messagingFactory.CreateMessageReceiver(_entityPath);

            _mockMessagingProvider.Setup(p => p.CreateMessageReceiver(_messagingFactory, _entityPath)).Returns(receiver);

            MessagingCommunicationException ex = await Assert.ThrowsAsync <MessagingCommunicationException>(async() =>
            {
                await _listener.StartAsync(CancellationToken.None);
            });

            Assert.Equal("Unable to connect to Service Bus using HTTP connectivity mode.", ex.Message);

            _mockMessagingProvider.VerifyAll();
        }
        public async Task StartAsync_CallsMessagingProviderToCreateReceiver()
        {
            MessageReceiver receiver = _messagingFactory.CreateMessageReceiver(_entityPath);

            _mockMessagingProvider.Setup(p => p.CreateMessageReceiver(_messagingFactory, _entityPath)).Returns(receiver);

            MessagingCommunicationException ex = await Assert.ThrowsAsync <MessagingCommunicationException>(async() =>
            {
                await _listener.StartAsync(CancellationToken.None);
            });

            Assert.Equal("No such host is known", ex.Message);

            _mockMessagingProvider.VerifyAll();
        }