public void Connect_Where_Connection_Is_Established_Results_In_Transition_To_Connected_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); List <State> _capturedStates = new List <State>(); _context.When(context => context.State = Arg.Any <State>()).Do(callInfo => _capturedStates.Add(callInfo[0] as State)); _SUT.Connect(); Assert.IsInstanceOf <Connecting>(_capturedStates[0]); Assert.IsInstanceOf <Connected>(_capturedStates[1]); }