public void checkAllScores(TennisGame game) {
   int highestScore = Math.Max(this.player1Score, this.player2Score);
   for (int i = 0; i < highestScore; i++) {
     if (i < this.player1Score)
       game.WonPoint("player1");
     if (i < this.player2Score)
       game.WonPoint("player2");
   }
   Assert.AreEqual(this.expectedScore, game.GetScore());
 }
Пример #2
0
        public void checkAllScores(TennisGame game)
        {
            int highestScore = Math.Max(this.player1Score, this.player2Score);

            for (int i = 0; i < highestScore; i++)
            {
                if (i < this.player1Score)
                {
                    game.WonPoint("player1");
                }
                if (i < this.player2Score)
                {
                    game.WonPoint("player2");
                }
            }
            Assert.AreEqual(this.expectedScore, game.GetScore());
        }
 public void RealisticTennisGame(TennisGame game)
 {
     String[] points =          {"player1", "player1", "player2", "player2", "player1", "player1"};
       String[] expected_scores = {"Fifteen-Love", "Thirty-Love", "Thirty-Fifteen", "Thirty-All", "Forty-Thirty", "Win for player1"};
       for (int i = 0; i < 6; i++) {
     game.WonPoint(points[i]);
     Assert.AreEqual(expected_scores[i], game.GetScore());
       }
 }
Пример #4
0
        public void AssertTennisScore(int player1Score, int player2Score, string expectedScore)
        {
            var game         = new TennisGame("player1", "player2");
            var highestScore = Math.Max(player1Score, player2Score);

            for (var i = 0; i < highestScore; i++)
            {
                if (i < player1Score)
                {
                    game.WonPoint("player1");
                }
                if (i < player2Score)
                {
                    game.WonPoint("player2");
                }
            }
            Assert.AreEqual(expectedScore, game.GetScore());
        }
Пример #5
0
 public void RealisticTennisGame(TennisGame game)
 {
     String[] points          = { "player1", "player1", "player2", "player2", "player1", "player1" };
     String[] expected_scores = { "Fifteen-Love", "Thirty-Love", "Thirty-Fifteen", "Thirty-All", "Forty-Thirty", "Win for player1" };
     for (int i = 0; i < 6; i++)
     {
         game.WonPoint(points[i]);
         Assert.AreEqual(expected_scores[i], game.GetScore());
     }
 }
        public void CheckTennisGame(int player1Score, int player2Score, string expectedScore)
        {
            var game         = new TennisGame("player1", "player2");
            var p1           = game.PlayerList.First(p => p.Name == "player1");
            var p2           = game.PlayerList.First(p => p.Name == "player2");
            var highestScore = Math.Max(player1Score, player2Score);

            for (var i = 0; i < highestScore; i++)
            {
                if (i < player1Score)
                {
                    game.WonPoint(p1.Id, p2.Id);
                }
                if (i < player2Score)
                {
                    game.WonPoint(p2.Id, p1.Id);
                }
            }
            Assert.AreEqual(expectedScore, game.GetScore());
        }
        public void CheckRealisticGame()
        {
            var game = new TennisGame("player1", "player2");

            string[] points         = { "player1", "player1", "player2", "player2", "player1", "player1" };
            string[] expectedScores = { "Fifteen-Love", "Thirty-Love", "Thirty-Fifteen", "Thirty-All", "Forty-Thirty", "Win for player1" };

            for (var i = 0; i < 6; i++)
            {
                game.WonPoint(game.PlayerList.First(p => p.Name == points[i]).Id, game.PlayerList.First(p => p.Name != points[i]).Id);
                Assert.AreEqual(expectedScores[i], game.GetScore());
            }
        }