public void StateSequenceCheckingLogEntryVisitorTest_FailingCase() { var stateA = new SleepState(2); var stateB = new TurnState(0.0, 1.0); var checker = new StateSequenceCheckingLogEntryVisitor(); checker.RegisterAsVisitor(brain); checker.StateTypeSequence.Enqueue(stateA.GetType()); checker.StateTypeSequence.Enqueue(stateB.GetType()); brain.CurrentState = stateB; brain.CurrentState = stateA; Assert.False(checker.AreAllStatesVisited()); }
public void StateSequenceCheckingLogEntryVisitorTest_SuccessfulCase() { var stateA = new SleepState(2); var stateB = new TurnState(0.0, 1.0); var checker = new StateSequenceCheckingLogEntryVisitor(); checker.RegisterAsVisitor(brain); checker.IgnoreIdleState = true; checker.StateTypeSequence.Enqueue(stateA.GetType()); checker.StateTypeSequence.Enqueue(stateB.GetType()); Assert.False(checker.AreAllStatesVisited()); brain.CurrentState = stateA; WaitTicks(2); Assert.False(checker.AreAllStatesVisited()); brain.CurrentState = stateB; WaitTicks(3); Assert.True(checker.AreAllStatesVisited()); brain.CurrentState = stateA; WaitTicks(2); Assert.False(checker.AreAllStatesVisited()); }
private void UpdateSleepPhaseDisplay(object sender, SleepState phase) { this.sleepPhaseLabel.Text = phase.GetType().ToString(); }