コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }