Exemple #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>());
        }
Exemple #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)));
        }
Exemple #3
0
 private void CreateGlobalState()
 {
     StateMachine.AddGlobalState(new StateOne());
 }