public void Ctor_Success() { var _busConfigurationBuilder = new BusConfigurationBuilder(); _busConfigurationBuilder.ConnectionUris.Add(TestingConfiguration.LocalConnectionUri); var _busConfirguration = _busConfigurationBuilder.Build(); var _connectionManager = Substitute.For<IConnectionManager>(); var _context = Substitute.For<IBusContext>(); var _SUT = new Closed( _busConfirguration, _connectionManager, _context); Assert.IsNotNull(_SUT); }
public void Connect_Where_Connection_Is_Not_Established_Results_In_Transition_To_Connecting_State() { var _busConfigurationBuilder = new BusConfigurationBuilder(); _busConfigurationBuilder.ConnectionUris.Add(TestingConfiguration.LocalConnectionUri); var _busConfirguration = _busConfigurationBuilder.Build(); var _connectionManager = Substitute.For<IConnectionManager>(); var _context = Substitute.For<IBusContext>(); var _SUT = new Closed( _busConfirguration, _connectionManager, _context); _context.State.Returns(callInfo => _SUT); State _capturedState = null; _context.When(context => context.State = Arg.Any<State>()).Do(callInfo => _capturedState = callInfo[0] as State); _SUT.Connect(); Assert.IsInstanceOf<Connecting>(_capturedState); }
public void Close_Results_In_An_Invalid_Operation_Exception() { var _busConfigurationBuilder = new BusConfigurationBuilder(); _busConfigurationBuilder.ConnectionUris.Add(TestingConfiguration.LocalConnectionUri); var _busConfirguration = _busConfigurationBuilder.Build(); var _connectionManager = Substitute.For<IConnectionManager>(); var _context = Substitute.For<IBusContext>(); var _SUT = new Closed( _busConfirguration, _connectionManager, _context); _SUT.Close(); }
public void Publish_Results_In_An_Exception() { var _busConfigurationBuilder = new BusConfigurationBuilder(); _busConfigurationBuilder.ConnectionUris.Add(TestingConfiguration.LocalConnectionUri); var _busConfirguration = _busConfigurationBuilder.Build(); var _connectionManager = Substitute.For<IConnectionManager>(); var _context = Substitute.For<IBusContext>(); var _SUT = new Closed( _busConfirguration, _connectionManager, _context); var _theEvent = new MyEvent(Guid.NewGuid(), null, "Some detail", 1); _SUT.PublishAsync(_theEvent); }