Exemple #1
0
        public void TestingnewBoard_moveCountToZero()
        {
            //Arrange
            IUI ui = new MockUI();
            GameLogic GLnewgame = new GameLogic(ui);
            GLnewgame.CreatePlayers();
            int expectedMoveCount = 0;

            //Act
            int actualMoveCount;
            actualMoveCount = GLnewgame.GetMoveCount();

            //Assert
            Assert.AreEqual(expectedMoveCount, actualMoveCount);
        }
Exemple #2
0
        public void TestingNewBoard()
        {
            //Arrange

            IUI ui = new MockUI();
            GameLogic GLnewgame = new GameLogic(ui);
            GLnewgame.NewBoard();

            //Act
            Board ActualBoard;
            ActualBoard = GLnewgame.GetGameBoard();

            //Assert
            Assert.IsInstanceOf<Board>(ActualBoard);
        }
Exemple #3
0
        public void TestingWinIn9Moves()
        {
            //Arange
            int[,] WinIn9 = new int[9, 2] { { 2, 2 }, { 2, 3 }, { 3, 2 }, { 1, 2 }, { 1, 3 }, { 3, 1 }, { 3, 3 }, { 2, 1 }, { 1, 1 } };
            MockUI ui = new MockUI(WinIn9, 9);
            bool expected = true;

            //Act
            GameLogic Game = new GameLogic(ui);
            Game.StartGame();
            bool actual = ui.GetAnnounceWinner();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #4
0
        public void TestingAnotherGame()
        {
            //Arange
            int[,] anotherGame = new int[9, 2] { { 2, 2 }, { 2, 3 }, { 3, 2 }, { 1, 2 }, { 1, 3 }, { 3, 1 }, { 3, 3 }, { 1, 1 }, { 2, 1 } };
            MockUI ui = new MockUI(anotherGame, 9);
            bool expected = true;

            //Act
            GameLogic Game = new GameLogic(ui);
            Game.StartGame();
            bool actual = ui.GetAnnounceDraw();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #5
0
        public void TestingCreatePlayers()
        {
            //Arrange
            IUI ui = new MockUI();
            GameLogic GLnewgame = new GameLogic(ui);
            GLnewgame.CreatePlayers();

            //Act
            Player ActualPlayer1, ActualPlayer2;
            ActualPlayer1 = GLnewgame.GetPlayer1();
            ActualPlayer2 = GLnewgame.GetPlayer2();

            //Assert
            Assert.IsInstanceOf<Player>(ActualPlayer1);
            Assert.IsInstanceOf<Player>(ActualPlayer2);
        }