Beispiel #1
0
        public void VictoryConditionDiagonalBottomToTopLeftToRight()
        {
            Board board = CreateBoard();

            for (int i = 0; i < board.Size; i++)
            {
                board.MarkBoard(CreatePlay(i, board.Size - 1 - i, Marker.X));
            }

            Play play = CreatePlay(0, 2, Marker.X);

            VictoryCondition ticTacToe = new VictoryCondition();

            bool isWinCondition = ticTacToe.FoundVictoryCondition(board, play.PlayerId);

            Assert.AreEqual(true, isWinCondition);
        }
Beispiel #2
0
        public void VictoryConditionInVerticalLine(int columnIndex)
        {
            Board board = CreateBoard();

            for (int i = 0; i < board.Size; i++)
            {
                board.MarkBoard(CreatePlay(i, columnIndex, Marker.X));
            }

            const int anyStartingXPosition = 0;

            Play play = CreatePlay(anyStartingXPosition, columnIndex, Marker.X);

            VictoryCondition ticTacToe = new VictoryCondition();

            bool isWinCondition = ticTacToe.FoundVictoryCondition(board, play.PlayerId);

            Assert.AreEqual(true, isWinCondition);
        }