public async Task Failing_To_Attach_To_Transport_Manager_Will_Return_False() { //Arrange var transport = new Mock <ITransport>(); var transportManager = new ServiceBusTransportManager(transport.Object, Mock.Of <ICircuitBreaker>(), Mock.Of <IEventLogger>()); var listener = new ServiceBusListener(_mockSerialiser.Object, _mockHandlerResolver.Object, _mockHandlerInvoker.Object); //Act var result = await listener.AttachTo(transportManager); //Assert Assert.That(result, Is.False); }
public async Task Listener_Can_Be_Attached_To_An_Active_Transport_Manager() { //Arrange var transport = new Mock <ITransport>(); transport.Setup(x => x.Configuration).Returns(new TransportConfiguration()); var transportManager = new ServiceBusTransportManager(transport.Object, Mock.Of <ICircuitBreaker>(), Mock.Of <IEventLogger>()); var listener = new ServiceBusListener(_mockSerialiser.Object, _mockHandlerResolver.Object, _mockHandlerInvoker.Object); //Act var result = await listener.AttachTo(transportManager); //Assert Assert.That(result, Is.True); Assert.That(transport.Object.Configuration.Listeners, Has.Exactly(1).EqualTo(listener)); }