Beispiel #1
0
        public void CurrentStateUpdate_IsCalled_ByUpdate()
        {
            var state = Substitute.For <ExplicitState>();
            var fsm   = new FinitiStateMachine.FiniteStateMachine(state);

            fsm.Update();

            state.Received().Update();
        }
Beispiel #2
0
        public void CurrentState_IsSetToInitialState_IfExplicitStateUpdateReturnsNull()
        {
            var state    = new ExplicitState();
            var newState = new ExplicitState();
            var fsm      = new FinitiStateMachine.FiniteStateMachine(state);

            fsm.Transition(newState);
            fsm.Update();

            Assert.AreEqual(state, fsm.CurrentState);
        }
Beispiel #3
0
        public void CurrentState_IsSetToNewState_IfExplicitStateUpdateReturnsState()
        {
            var newState = new ExplicitState();
            var state    = Substitute.For <ExplicitState>();

            state.Update().Returns(newState);
            var fsm = new FinitiStateMachine.FiniteStateMachine(state);

            fsm.Update();

            Assert.AreEqual(newState, fsm.CurrentState);
        }