示例#1
0
        public void TransitionToGlobalStateWithANonGlobalStateResultsInNonGlobalStateException()
        {
            StateMachine.AddState(new StateOne());
            StateMachine.AddGlobalState(new StateTwo());

            StateMachine.SetInitialState <StateTwo>();
            StateMachine.Start();

            //Assert
            Assert.Throws <NonGlobalStateException>(() => StateMachine.TransitionToGlobalState <StateOne>());
        }
示例#2
0
        public void GlobalStateDoesNotNeedASetUpTransitionToMoveToThatStateFromAnyState()
        {
            StateMachine.AddState(new StateOne());
            StateMachine.AddGlobalState(new StateTwo());

            StateMachine.SetInitialState <StateOne>();
            StateMachine.Start();

            //Act
            StateMachine.TransitionToGlobalState <StateTwo>();

            //Assert
            Assert.That(StateMachine.CurrentState, Is.TypeOf(typeof(StateTwo)));
        }
示例#3
0
 private void CreateGlobalState()
 {
     StateMachine.AddGlobalState(new StateOne());
 }