Exemplo n.º 1
0
 private static void ScorePoints(ITennisGame game, string playerName, int points)
 {
     for (var i = 0; i < points; i++)
     {
         game.WonPoint(playerName);
     }
 }
Exemplo n.º 2
0
 protected void scorePoints(ITennisGame game, string playerName, int points)
 {
     for (int i = 0; i < points; i++)
     {
         game.WonPoint(playerName);
     }
 }
Exemplo n.º 3
0
        private void CheckAllScores(ITennisGame game)
        {
            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.CalculateScore());
        }
Exemplo n.º 4
0
        public void CheckAllScores(ITennisGame game)
        {
            var highestScore = Math.Max(_player1Score, _player2Score);

            for (var i = 0; i < highestScore; i++)
            {
                if (i < _player1Score)
                {
                    game.WonPoint(Player1Name);
                }
                if (i < _player2Score)
                {
                    game.WonPoint(Player2Name);
                }
            }
            Assert.AreEqual(_expectedScore, game.GetScore());
        }
Exemplo n.º 5
0
        public void checkAllScores(ITennisGame 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());
        }
Exemplo n.º 6
0
        private void CheckAllScores(ITennisGame game)
        {
            var highestScore = Math.Max(this.player1Score, this.player2Score);

            for (var i = 0; i < highestScore; i++)
            {
                if (i < this.player1Score)
                {
                    game.WonPoint(this.Player1);
                }
                if (i < this.player2Score)
                {
                    game.WonPoint(this.Player2);
                }
            }
            Assert.AreEqual(this.expectedScore, game.GetScore());
        }
Exemplo n.º 7
0
        //[Test]
        //public void checkTennisGame2()
        //{
        //    TennisGame2 game = new TennisGame2("player1", "player2");
        //    checkAllScores(game);
        //}

        //[Test]
        //public void checkTennisGame3()
        //{
        //    TennisGame3 game = new TennisGame3("player1", "player2");
        //    checkAllScores(game);
        //}

        public void CheckAllScores(ITennisGame game)
        {
            int highestScore = Math.Max(m_Player1Score, m_Player2Score);

            for (int i = 0; i < highestScore; i++)
            {
                if (i < m_Player1Score)
                {
                    game.WonPoint(Names.Player1);
                }
                if (i < m_Player2Score)
                {
                    game.WonPoint(Names.Player2);
                }
            }
            Assert.AreEqual(m_ExpectedScore, game.GetScore());
        }
Exemplo n.º 8
0
        private void CheckScore(ITennisGame game, PlayerScore score)
        {
            var highestScore = Math.Max(score.Player1Score, score.Player2Score);

            for (var i = 0; i < highestScore; i++)
            {
                if (i < score.Player1Score)
                {
                    game.WonPoint("player1");
                }
                if (i < score.Player2Score)
                {
                    game.WonPoint("player2");
                }
            }
            Assert.Equal(score.ExpectedScore, game.GetScore());
        }
Exemplo n.º 9
0
        protected void CheckAllScores(ITennisGame game, int player1Score, int player2Score, string expectedScore)
        {
            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());
        }
Exemplo n.º 10
0
        public void CheckAllScores(int player1Score, int player2Score, string expectedScore, ITennisGame game)
        {
            int highestScore = Math.Max(player1Score, player2Score);

            for (int i = 0; i < highestScore; i++)
            {
                if (i < player1Score)
                {
                    game.WonPoint("player1");
                }
                if (i < player2Score)
                {
                    game.WonPoint("player2");
                }
            }

            Assert.Equal(expectedScore, game.GetScore());
        }
 public void RealisticTennisGame(ITennisGame 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());
       }
 }
Exemplo n.º 12
0
 private void RealisticTennisGame(ITennisGame game)
 {
     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(points[i]);
         Assert.AreEqual(expectedScores[i], game.CalculateScore());
     }
 }
Exemplo n.º 13
0
 public void RealisticTennisGame(ITennisGame 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());
     }
 }
        private static void RealisticTennisGame(ITennisGame game)
        {
            var pointsWon = new List <Point>
            {
                new Point(player1Name, "Fifteen-Love"),
                new Point(player1Name, "Thirty-Love"),
                new Point(player2Name, "Thirty-Fifteen"),
                new Point(player2Name, "Thirty-All"),
                new Point(player1Name, "Forty-Thirty"),
                new Point(player1Name, "Love-All"),
            };

            foreach (var pointWon in pointsWon)
            {
                game.WonPoint(pointWon.playerName);
                Assert.AreEqual(pointWon.score, game.GetScore());
            }
        }
Exemplo n.º 15
0
 public void checkAllScores(ITennisGame 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());
 }