コード例 #1
0
ファイル: GameLogicTest.cs プロジェクト: fannar82/Confusion
        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);
        }
コード例 #2
0
ファイル: GameLogicTest.cs プロジェクト: fannar82/Confusion
        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);
        }
コード例 #3
0
ファイル: EndToEndTest.cs プロジェクト: fannar82/Confusion
        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);
        }
コード例 #4
0
ファイル: EndToEndTest.cs プロジェクト: fannar82/Confusion
        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);
        }
コード例 #5
0
ファイル: GameLogicTest.cs プロジェクト: fannar82/Confusion
        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);
        }