Exemplo n.º 1
0
 public void TestMakeMoveO()
 {
     TicTacToe.GamePlay gamePlay = new TicTacToe.GamePlay();
     gamePlay.CreateBoard();
     gamePlay.ChangePlayer("O");
     gamePlay.MakeMove(1, 1);
     Assert.AreEqual(2, gamePlay.Board[1, 1]);
 }
Exemplo n.º 2
0
        public void TestCurrentPlayerO()
        {
            TicTacToe.GamePlay gamePlay = new TicTacToe.GamePlay();
            gamePlay.ChangePlayer("O");
            string player = gamePlay.CurrentPlayer();

            Assert.AreEqual("O", player);
        }
Exemplo n.º 3
0
 public void TestMakeMoveX()
 {
     TicTacToe.GamePlay gamePlay = new TicTacToe.GamePlay();
     gamePlay.CreateBoard();
     gamePlay.ChangePlayer("X");
     gamePlay.MakeMove(0, 0);
     Assert.AreEqual(1, gamePlay.Board[0, 0]);
 }
Exemplo n.º 4
0
        public void TestSpaceInUse()
        {
            TicTacToe.GamePlay gamePlay = new TicTacToe.GamePlay();
            gamePlay.CreateBoard();

            Assert.AreEqual(false, gamePlay.SpaceInUse(0, 1));
            gamePlay.ChangePlayer("X");
            gamePlay.MakeMove(0, 1);
            Assert.AreEqual(true, gamePlay.SpaceInUse(0, 1));
        }
Exemplo n.º 5
0
        public void TestCreateBoard()
        {
            TicTacToe.GamePlay gamePlay = new TicTacToe.GamePlay();
            gamePlay.CreateBoard();
            int[,] board = gamePlay.Board;
            int expectedBoard = 9; // the created board has 9 fields
            int expected      = 0; // value for initiating board

            Assert.AreEqual(expectedBoard, board.Length);

            for (int i = 0; i < SIZE; i++)
            {
                for (int j = 0; j < SIZE; j++)
                {
                    Assert.AreEqual(expected, board[i, j]);
                }
            }
        }