public void LogException() { _stateMachine.MonitorEvents(); _stateMachine.Initialize(States.On); _stateMachine.Start(); _loggerMock.Setup(logger => logger.Debug("StateMachine Test fires event TurnOff")); _loggerMock.Setup(logger => logger.Error("TransitionException handled in StateMachine Test in transition On->Off")); _stateMachine.Fire(Events.TurnOff); // this leads to an exception _stateMachine.ShouldRaise("TransitionExceptionThrown"); _loggerMock.VerifyAll(); }