コード例 #1
0
        public void ComputerAIConstructorTest()
        {
            BoardManager board = new BoardManager();
            HumanPlayer playerOne = new HumanPlayer();
            ComputerPlayer playerTwo = new ComputerPlayer('O');
            board.LogMove(playerOne.MakeMove(0, 0));

            ComputerAI target = new ComputerAI(playerOne.identity, playerTwo.identity);

            Assert.AreEqual('X', target.enemyIdentity);
        }
コード例 #2
0
 public void GetRandomMoveShouldReturnARandomMoveFromAvailableSpaces()
 {
     BoardManager board = new BoardManager();
     HumanPlayer playerOne = new HumanPlayer();
     ComputerPlayer playerTwo = new ComputerPlayer('O');
     board.LogMove(playerOne.MakeMove(1, 1));
     ComputerAI target = new ComputerAI(playerOne.identity, playerTwo.identity);
     CreatedMove actual = target.GetRandomMove(board.boardArray);
     CreatedMove notExpected = new CreatedMove(1, 1, 'O');
     Assert.IsTrue(actual.xAxis >= 0 && actual.xAxis <= 2);
     Assert.IsTrue(actual.yAxis >= 0 && actual.yAxis <= 2);
     Assert.AreNotEqual(notExpected, actual);
 }