Esempio n. 1
0
        public void NextTurn_ValidUse_Success()
        {
            // Arrange
            var ticTacToe = new Tictactoe(GetBoardButtons());

            ticTacToe.StartNewGame(true, false, 0);

            // Act
            bool shouldBeTrue = ticTacToe.Turn;

            ticTacToe.NextTurn();

            bool shouldBeFalse = ticTacToe.Turn;

            ticTacToe.NextTurn();

            bool shouldBeTrueAgain = ticTacToe.Turn;

            // Assert
            Assert.AreEqual(true, shouldBeTrue);
            Assert.AreEqual(false, shouldBeFalse);
            Assert.AreEqual(true, shouldBeTrueAgain);
        }
Esempio n. 2
0
        public void GetCurrentTurnPlayerMark_ValidUse_Success()
        {
            // Arrange
            var ticTacToe = new Tictactoe(GetBoardButtons());

            ticTacToe.StartNewGame(true, false, 0);

            // Act
            string shouldBeCrossMark = ticTacToe.GetCurrentTurnPlayerMark();

            ticTacToe.NextTurn();

            string shouldBeCircleMark = ticTacToe.GetCurrentTurnPlayerMark();

            ticTacToe.NextTurn();

            string shouldBeCrossMarkAgain = ticTacToe.GetCurrentTurnPlayerMark();

            // Assert
            Assert.AreEqual(Resources.BoardCrossMark, shouldBeCrossMark);
            Assert.AreEqual(Resources.BoardCircleMark, shouldBeCircleMark);
            Assert.AreEqual(Resources.BoardCrossMark, shouldBeCrossMarkAgain);
        }
Esempio n. 3
0
        public void PlaceMarker_ValidUse_Success()
        {
            // Arrange
            var ticTacToe = new Tictactoe(GetBoardButtons());

            ticTacToe.StartNewGame(true, false, 0);
            var buttonForCrossMarkPlacement  = GetBoardButtons().First(x => x.Tag.ToString() == "00");
            var buttonForCircleMarkPlacement = GetBoardButtons().First(x => x.Tag.ToString() == "01");

            // Act
            ticTacToe.PlaceMarker(buttonForCrossMarkPlacement);
            ticTacToe.NextTurn();
            ticTacToe.PlaceMarker(buttonForCircleMarkPlacement);

            var buttonWithCrossMark  = buttonForCrossMarkPlacement.Content.ToString();
            var buttonWithCircleMark = buttonForCircleMarkPlacement.Content.ToString();

            // Assert
            Assert.AreEqual(Resources.BoardCrossMark, buttonWithCrossMark);
            Assert.AreEqual(Resources.BoardCircleMark, buttonWithCircleMark);
        }