コード例 #1
0
        private string GetLessThan4ScoreDescription()
        {
            var player1ScoreDescription = ScoreHelper.ScoreDescription(_player1Score);
            var player2ScoreDescription = ScoreHelper.ScoreDescription(_player2Score);

            return($"{player1ScoreDescription}-{player2ScoreDescription}");
        }
コード例 #2
0
ファイル: TennisGame2.cs プロジェクト: Joe-LaRue/TennisKata
        private string GetTieScoreDescription()
        {
            if (_player1Point > 2)
            {
                return("Deuce");
            }

            var scoreDescription = ScoreHelper.ScoreDescription(_player1Point);

            return($"{scoreDescription}-All");
        }
コード例 #3
0
 private string GetTieScoreDescription()
 {
     if (_player1Score < 3)
     {
         var scoreDescription = ScoreHelper.ScoreDescription(_player1Score);
         return($"{scoreDescription}-All");
     }
     else
     {
         return("Deuce");
     }
 }
コード例 #4
0
ファイル: TennisGame2.cs プロジェクト: Joe-LaRue/TennisKata
        public string GetScore()
        {
            if (ScoreIsTied())
            {
                return(GetTieScoreDescription());
            }

            if (BothPlayersHaveLessThan4Points())
            {
                var player1ScoreDescription = ScoreHelper.ScoreDescription(_player1Point);
                var player2ScoreDescription = ScoreHelper.ScoreDescription(_player2Point);

                return($"{player1ScoreDescription}-{player2ScoreDescription}");
            }

            if (Player1Leads())
            {
                return(GetPlayer1LeadingScore());
            }
            else
            {
                return(GetPlayer2LeadingScore());
            }
        }