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"); } }
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"); } }