Esempio n. 1
0
 public void GameShouldBeAbleToCheckAMovesValidity()
 {
     Game target = new Game(new HumanPlayer('X'), new HumanPlayer('O'), new BoardManager());
     target.LogMove(new Tuple<int, int>(1, 1));
     bool actual = target.IsMoveValid(new Tuple<int,int>(1,1));
     bool expected = false;
     Assert.AreEqual(expected, actual);
 }
Esempio n. 2
0
 public void GameShouldBeAbleToGetBoardArray()
 {
     Game target = new Game(new HumanPlayer(), new HumanPlayer());
     char[,] actual = target.GetBoard();
     char[,] expected = new char[3, 3];
     CollectionAssert.AreEqual(expected, actual);
     target.LogMove(new Tuple<int, int>(1, 1));
     expected[1, 1] = 'X';
     CollectionAssert.AreEqual(expected, actual);
 }
Esempio n. 3
0
 public void ResetGameShouldBlankAllValues()
 {
     Game target = new Game(new HumanPlayer('X'), new HumanPlayer('O'), new BoardManager());
     target.LogMove(new Tuple<int,int>(1,1));
     target.LogMove(new Tuple<int,int>(1,1));
     target.ResetGame();
     Assert.AreEqual(null, target.xPlayer);
     Assert.AreEqual(null, target.oPlayer);
     CollectionAssert.AreEqual(new char[3, 3], target.board.boardArray);
 }
Esempio n. 4
0
 public void NextMoveShouldCallMakeMoveOfAppropriatePlayer()
 {
     Game target = new Game(new HumanPlayer('X'), new ComputerPlayer('O'));
     Tuple<int,int> actual = target.NextMove();
     Tuple<int,int> expected = null;
     Assert.AreEqual(expected, actual);
     target.LogMove(new Tuple<int, int>(1, 1));
     actual = target.NextMove();
     Tuple<int, int> notExpected = null;
     Assert.AreNotEqual(notExpected, actual);
 }
Esempio n. 5
0
 public void GameShouldKnowWhoIsActivePlayer()
 {
     Game target = new Game(new HumanPlayer(), new ComputerPlayer());
     char actual = target.GetActivePlayerID();
     char expected = 'X';
     Assert.AreEqual(expected, actual);
     target.LogMove(new Tuple<int, int>(1, 1));
     actual = target.GetActivePlayerID();
     expected = 'O';
     Assert.AreEqual(expected, actual);
 }
Esempio n. 6
0
 public void GameShouldBeAbleToLogMoves()
 {
     Game target = new Game(new HumanPlayer('X'), new HumanPlayer('O'), new BoardManager());
     target.LogMove(new Tuple<int,int>(1,1));
     char actual = target.board.boardArray[1, 1];
     char expected = 'X';
     Assert.AreEqual(expected, actual);
 }
 public void BoardManagerShouldTrackNumberOfMoves()
 {
     Game target = new Game(new HumanPlayer('X'), new HumanPlayer('O'));
     target.LogMove(new Tuple<int, int>(1, 1));
     Assert.AreEqual(1, target.board.movesMade);
 }