public void GameManagerShouldBeAbleToReportOnWinsAndTies()
        {
            GameManager target = new GameManager();
            target.MakeGame("human");
            target.game.board.ForceMove(new Tuple<int, int>(0, 0), 'X');
            target.game.board.ForceMove(new Tuple<int, int>(1, 0), 'X');
            target.game.board.ForceMove(new Tuple<int, int>(2, 0), 'X');
            target.ReportGameEnd();

            target = new GameManager();
            target.MakeGame("human");
            target.game.board.ForceMove(new Tuple<int, int>(0, 0), 'O');
            target.game.board.ForceMove(new Tuple<int, int>(1, 0), 'O');
            target.game.board.ForceMove(new Tuple<int, int>(2, 0), 'O');
            target.ReportGameEnd();

            target = new GameManager();
            target.MakeGame("human");
            target.game.board.LogMove(new Tuple<int, int>(1, 1));
            target.game.board.LogMove(new Tuple<int, int>(0, 0));
            target.game.board.LogMove(new Tuple<int, int>(0, 1));
            target.game.board.LogMove(new Tuple<int, int>(2, 1));
            target.game.board.LogMove(new Tuple<int, int>(0, 2));
            target.game.board.LogMove(new Tuple<int, int>(2, 0));
            target.game.board.LogMove(new Tuple<int, int>(1, 0));
            target.game.board.LogMove(new Tuple<int, int>(1, 2));
            target.game.board.LogMove(new Tuple<int, int>(2, 2));
            target.ReportGameEnd();
        }
Ejemplo n.º 2
0
 public void fauxInputTest()
 {
     GameManager testManager = new GameManager(new PresentationManager(new TestIO()));
     TestIO io = (TestIO)testManager.presenter.IO;
     io.desiredInString = "human";
     testManager.MakeGame(testManager.presenter.WelcomeAndAskForGameParams());
     Assert.AreEqual(testManager.game.xPlayer.GetType(), typeof(HumanPlayer));
     Assert.AreEqual(testManager.game.oPlayer.GetType(), typeof(HumanPlayer));
     testManager.game.board.ForceMove(new Tuple<int,int>(0,0), 'X');
     testManager.game.board.ForceMove(new Tuple<int,int>(1,0), 'X');
     testManager.game.board.ForceMove(new Tuple<int,int>(2,0), 'X');
     testManager.ReportGameEnd();
     StringAssert.Equals("X's Win!", io.lastOutString);
 }