Ejemplo n.º 1
0
 public void ShouldNotBeInAnyStateInitially()
 {
     var stateMachine = new StateMachine("test-state");
     foreach (string state in states)
     {
         Assert.IsFalse(stateMachine.Is(state).IsActive(), "state machine should not be in any state");
         Assert.IsTrue(stateMachine.IsNot(state).IsActive(), "state machine should not be in any state");
     }
 }
Ejemplo n.º 2
0
 public void CanEnterAState()
 {
     HashSet<string> otherStates = Except("state1", states);
     var stateMachine = new StateMachine("test-state");
     stateMachine.Is("state1").Activate();
     Assert.That(stateMachine.Is("state1").IsActive(), "should be active");
     foreach (string otherState in otherStates)
     {
         Assert.IsFalse(stateMachine.Is(otherState).IsActive(), "should not be in other state");
         Assert.That(stateMachine.IsNot(otherState).IsActive(), "should not be in other state");
     }
 }