Appccelerate.StateMachine.Machine.ExceptionCasesTest.ExitActionWhenThrowingExceptionThenNotificationAndStateIsEntered C# (CSharp) Method

ExitActionWhenThrowingExceptionThenNotificationAndStateIsEntered() private method

        public void ExitActionWhenThrowingExceptionThenNotificationAndStateIsEntered()
        {
            var eventArguments = new object[] { 1, 2, "test" };
            Exception exception = new Exception();

            this.testee.In(StateMachine.States.A)
                .ExecuteOnExit(() =>
                                   {
                                       throw exception;
                                   })
                .On(StateMachine.Events.B).Goto(StateMachine.States.B);

            this.testee.Initialize(StateMachine.States.A);
            this.testee.EnterInitialState();

            this.testee.Fire(StateMachine.Events.B, eventArguments);

            this.AssertException(StateMachine.States.A, StateMachine.Events.B, eventArguments, exception);
            Assert.Equal(StateMachine.States.B, this.testee.CurrentStateId);
        }