Exemplo n.º 1
0
        public void SetAdvantage()
        {
            TennisGame game = new TennisGame("Name_1", "Name_2");

            game.SetAdvantage(1);
            Assert.IsTrue(game.Advantage() == game.Player_1().Name());
        }
Exemplo n.º 2
0
        public void StartAdvantage()
        {
            TennisGame game = new TennisGame("Name_1", "Name_2");

            Assert.IsTrue(game.Advantage() == "Nothing");
            //We use player name or nothing to avoid creation third player
        }
Exemplo n.º 3
0
        public void ClearAdvantage()
        {
            TennisGame game = new TennisGame("Name_1", "Name_2");

            game.SetAdvantage(2);
            game.ClearAdvantage();
            Assert.IsTrue(game.Advantage() == "Nothing");
        }
Exemplo n.º 4
0
        public void UpFiveRoundWithAD()
        {
            TennisGame game = new TennisGame("Name_1", "Name_2");

            game.UpRound(game.Player_1());
            game.UpRound(game.Player_1());
            game.UpRound(game.Player_1());
            game.UpRound(game.Player_2());
            game.UpRound(game.Player_2());
            game.UpRound(game.Player_2());
            game.UpRound(game.Player_1());
            game.UpRound(game.Player_1());
            Assert.IsTrue((game.Player_1().Score(0) == 0) && (game.Player_2().Score(0) == 0) && (game.Player_1().Score(1) == 1) && (game.Player_2().Score(1) == 0) && (game.result[0, 0] == 1) && (game.result[1, 0] == 0) && (game.Advantage() == "Nothing"));
        }
Exemplo n.º 5
0
        public void UpFourthRoundWithoutAD()
        {
            TennisGame game = new TennisGame("Name_1", "Name_2");

            game.UpRound(game.Player_1());
            game.UpRound(game.Player_1());
            game.UpRound(game.Player_1());
            game.UpRound(game.Player_2());
            game.UpRound(game.Player_2());
            game.UpRound(game.Player_2());
            game.UpRound(game.Player_1());
            Assert.IsTrue((game.Player_1().Score(0) == 40) && (game.Player_2().Score(0) == 40) && (game.result[0, 0] == 0) && (game.result[1, 0] == 0) && (game.Advantage() == "Name_1"));
        }