Пример #1
0
        public void HasPlayerWon_PlayerMarkParameterIsInvalid_ThrowsException()
        {
            // Arrange
            const string invalidPlayerMark = "A";

            // Act
            bool result = Tictactoe.HasPlayerWon(BoardAllEmptyField, invalidPlayerMark);

            // Assert
            Assert.Fail("No exception was thrown.");
        }
Пример #2
0
        public void HasPlayerWon_BoardParameterIsNull_ThrowsException()
        {
            // Arrange
            string[,] gameBoard = null;

            // Act
            bool result = Tictactoe.HasPlayerWon(gameBoard, Resources.BoardCrossMark);

            // Assert
            Assert.Fail("No exception was thrown.");
        }
Пример #3
0
        public void HasPlayerWon_DiagonalsAreCircle_Success()
        {
            // Arrange

            // Act
            bool topLeftBottomRightDiagonalAllCircleResult =
                Tictactoe.HasPlayerWon(GetBoardTopLeftBottomRightDiagonalAllCircle(), Resources.BoardCircleMark);
            bool topRightBottomLeftDiagonalAllCircleResult =
                Tictactoe.HasPlayerWon(GetBoardTopRightBottomLeftDiagonalAllCircle(), Resources.BoardCircleMark);

            // Assert
            Assert.IsTrue(topLeftBottomRightDiagonalAllCircleResult);
            Assert.IsTrue(topRightBottomLeftDiagonalAllCircleResult);
        }
Пример #4
0
        public void HasPlayerWon_ColumnsAreCircle_Success()
        {
            // Arrange

            // Act
            bool firsColumnAllCircleResult   = Tictactoe.HasPlayerWon(GetBoardFirstColumnAllCircle(), Resources.BoardCircleMark);
            bool secondColumnAllCircleResult = Tictactoe.HasPlayerWon(GetBoardSecondColumnAllCircle(), Resources.BoardCircleMark);
            bool thirdColumnAllCircleResult  = Tictactoe.HasPlayerWon(GetBoardThirdColumnAllCircle(), Resources.BoardCircleMark);

            // Assert
            Assert.IsTrue(firsColumnAllCircleResult);
            Assert.IsTrue(secondColumnAllCircleResult);
            Assert.IsTrue(thirdColumnAllCircleResult);
        }
Пример #5
0
        public void HasPlayerWon_RowsAreCross_Success()
        {
            // Arrange

            // Act
            bool firstRowAllCrossResult  = Tictactoe.HasPlayerWon(GetBoardFirstRowAllCross(), Resources.BoardCrossMark);
            bool secondRowAllCrossResult = Tictactoe.HasPlayerWon(GetBoardSecondRowAllCross(), Resources.BoardCrossMark);
            bool thirdRowAllCrossResult  = Tictactoe.HasPlayerWon(GetBoardThirdRowAllCross(), Resources.BoardCrossMark);

            // Assert
            Assert.IsTrue(firstRowAllCrossResult);
            Assert.IsTrue(secondRowAllCrossResult);
            Assert.IsTrue(thirdRowAllCrossResult);
        }