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