Beispiel #1
0
        public void SetAdvantage()
        {
            TennisGame game = new TennisGame("Name_1", "Name_2");

            game.SetAdvantage(1);
            Assert.IsTrue(game.Advantage() == game.Player_1().Name());
        }
Beispiel #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
        }
Beispiel #3
0
        public void ClearAdvantage()
        {
            TennisGame game = new TennisGame("Name_1", "Name_2");

            game.SetAdvantage(2);
            game.ClearAdvantage();
            Assert.IsTrue(game.Advantage() == "Nothing");
        }
Beispiel #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"));
        }
Beispiel #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"));
        }