public void CheckHeightOfPlayedColumnIsCorrect() { var game = new Game(); var board = new BoardAPI(10, 8); board.MakeMove(game.Cells, 1, true); board.MakeMove(game.Cells, 1, true); board.MakeMove(game.Cells, 1, true); var actualResult = board.GetHeightOfColumn(game.Cells, 1); Assert.AreEqual(3, actualResult); }
public void CheckForWinningVerticalMove() { var game = new Game(); var board = new BoardAPI(Game.NUMBER_OF_COLUMNS, Game.NUMBER_OF_ROWS); board.MakeMove(game.Cells, 2, true); board.MakeMove(game.Cells, 2, true); board.MakeMove(game.Cells, 2, true); board.MakeMove(game.Cells, 2, true); var actualResult = board.WasWinningMove(game.Cells, 2, true); Assert.IsTrue(actualResult); }
private static void MakeNonWinningMove(Game game, int columnNumber, bool isYellow) { var board = new BoardAPI(Game.NUMBER_OF_COLUMNS, Game.NUMBER_OF_ROWS); board.MakeMove(game.Cells, columnNumber, isYellow); Assert.IsFalse(board.WasWinningMove(game.Cells, columnNumber, isYellow)); }
public void CheckPlayingANewBoardIsNotAWin() { var game = new Game(); var board = new BoardAPI(Game.NUMBER_OF_COLUMNS, Game.NUMBER_OF_ROWS); board.MakeMove(game.Cells, 1, true); var actualResult = board.WasWinningMove(game.Cells, 1, true); Assert.IsFalse(actualResult); }
public void CheckFullyPlayedBoardIsFull() { var game = new Game(); var board = new BoardAPI(Game.NUMBER_OF_COLUMNS, Game.NUMBER_OF_ROWS); for (int c = 0; c < Game.NUMBER_OF_COLUMNS; c++) { for (int r = 0; r < Game.NUMBER_OF_ROWS; r++) { board.MakeMove(game.Cells, c, true); } } var actualResult = board.IsBoardFull(game.Cells); Assert.IsTrue(actualResult); }
public void CheckForWinningDiagonalSWtoNE_Move() { var game = new Game(); var board = new BoardAPI(Game.NUMBER_OF_COLUMNS, Game.NUMBER_OF_ROWS); MakeNonWinningMove(game, 4, RED); MakeNonWinningMove(game, 4, YELLOW); MakeNonWinningMove(game, 4, RED); MakeNonWinningMove(game, 4, YELLOW); MakeNonWinningMove(game, 3, YELLOW); MakeNonWinningMove(game, 3, RED); MakeNonWinningMove(game, 3, YELLOW); MakeNonWinningMove(game, 2, RED); MakeNonWinningMove(game, 2, YELLOW); board.MakeMove(game.Cells, 1, YELLOW); var actualResult = board.WasWinningMove(game.Cells, 1, YELLOW); Assert.IsTrue(actualResult); }