示例#1
0
 public void MakeAMove_IncrementsTotalMoves_Test()
 {
     _board = new Board();
     var startCounter = _board.TotalMovesMade;
     _board.MakeAMove(_noughts, _board.GetRandomChoice());
     Assert.IsTrue(_board.TotalMovesMade == ++startCounter, "Total moves made didnt increment as expected");
 }
示例#2
0
        public void MakeAMove_IncrementsTotalMoves_Test()
        {
            _board = new Board();
            var startCounter = _board.TotalMovesMade;

            _board.MakeAMove(_noughts, _board.GetRandomChoice());
            Assert.IsTrue(_board.TotalMovesMade == ++startCounter, "Total moves made didnt increment as expected");
        }
示例#3
0
 public void MakeAMove_InvalidMove_Test()
 {
     _board = new Board();
     var choice = _board.GetRandomChoice();
     _board.MakeAMove(_noughts, choice);
     Assert.Throws<InvalidMoveException>(() => _board.MakeAMove(_noughts, choice),
         "Performing the same move twice should have thrown an InvalidMoveException");
 }
示例#4
0
 public void KnotsSquares_UpdatesAfterMoves_Test()
 {
     _board = new Board();
     var startCounter = _board.TotalMovesMade;
     _board.MakeAMove(_noughts, _board.GetRandomChoice());
     Assert.IsTrue(_board.NoughtsSquares.Count() == ++startCounter,
         "Noughts moves made didnt increment as expected");
 }
示例#5
0
 public void GetSquare_AfterUpdateCorrectResult_Test()
 {
     _board = new Board();
     var choice = _board.GetRandomChoice();
     _board.MakeAMove(_noughts, choice);
     Assert.IsTrue(_board.GetSquare(choice) == Board.SquareState.Noughts,
         "Correctly obtaining the square after update");
 }
示例#6
0
        public void MakeAMove_InvalidMove_Test()
        {
            _board = new Board();
            var choice = _board.GetRandomChoice();

            _board.MakeAMove(_noughts, choice);
            Assert.Throws <InvalidMoveException>(() => _board.MakeAMove(_noughts, choice),
                                                 "Performing the same move twice should have thrown an InvalidMoveException");
        }
示例#7
0
        public void KnotsSquares_UpdatesAfterMoves_Test()
        {
            _board = new Board();
            var startCounter = _board.TotalMovesMade;

            _board.MakeAMove(_noughts, _board.GetRandomChoice());
            Assert.IsTrue(_board.NoughtsSquares.Count() == ++startCounter,
                          "Noughts moves made didnt increment as expected");
        }
示例#8
0
        public void GetSquare_AfterUpdateCorrectResult_Test()
        {
            _board = new Board();
            var choice = _board.GetRandomChoice();

            _board.MakeAMove(_noughts, choice);
            Assert.IsTrue(_board.GetSquare(choice) == Board.SquareState.Noughts,
                          "Correctly obtaining the square after update");
        }
示例#9
0
 public Point GetRandomChoice()
 {
     return(_gameBoard.GetRandomChoice());
 }