Beispiel #1
0
        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());
        }
Beispiel #2
0
        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());
        }
Beispiel #3
0
 public void ShowInputMessage(TurnState turn)
 {
     Console.WriteLine("This turn is " + turn.GetType() + "(" + turn.DiskColor + ")");
     Console.Write("Input: ");
 }
Beispiel #4
0
 public void ShowResult(TurnState win, TurnState lose)
 {
     Console.WriteLine("Game Finish.");
     Console.WriteLine("Win: " + win.GetType());
     Console.WriteLine("Lose: " + lose.GetType());
 }