Beispiel #1
0
        public void Then_Is_Any_Above_Thirty_Is_True()
        {
            var points = new GamePoints {
                PlayerTwo = 3
            };

            Assert.IsTrue(points.IsAnyAboveThirty());
        }
Beispiel #2
0
        static string ScoreForPlayersEqual(GamePoints points)
        {
            string scoreOfPlayerOne = Game.ScoreForPoint(points.PlayerOne);

              return points.IsAnyAboveThirty()
            ? "Deuce"
            : scoreOfPlayerOne + " All";
        }
Beispiel #3
0
        static string ScoreForPlayersEqual(GamePoints points)
        {
            string scoreOfPlayerOne = Game.ScoreForPoint(points.PlayerOne);

            return(points.IsAnyAboveThirty()
        ? "Deuce"
        : scoreOfPlayerOne + " All");
        }
Beispiel #4
0
        static string ScoreForPlayerLeading(GamePoints points)
        {
            string scoreOfPlayerOne = Game.ScoreForPoint(points.PlayerOne);
              string scoreOfPlayerTwo = Game.ScoreForPoint(points.PlayerTwo);

              return points.IsAnyInAdvantage()
            ? ScoreForPlayerLeadingInAdvantage(points)
            : scoreOfPlayerOne + " " + scoreOfPlayerTwo;
        }
Beispiel #5
0
        static string ScoreForPlayerLeading(GamePoints points)
        {
            string scoreOfPlayerOne = Game.ScoreForPoint(points.PlayerOne);
            string scoreOfPlayerTwo = Game.ScoreForPoint(points.PlayerTwo);

            return(points.IsAnyInAdvantage()
        ? ScoreForPlayerLeadingInAdvantage(points)
        : scoreOfPlayerOne + " " + scoreOfPlayerTwo);
        }
Beispiel #6
0
        public static Game At(int pointsOfPlayerOne, int pointsOfPlayerTwo)
        {
            var points = new GamePoints { PlayerOne = pointsOfPlayerOne, PlayerTwo = pointsOfPlayerTwo };
              var score = Game.ScoreForPoints(points);

              return new Game {
            Points = points,
            Score = score
              };
        }
Beispiel #7
0
        public static Game At(int pointsOfPlayerOne, int pointsOfPlayerTwo)
        {
            var points = new GamePoints {
                PlayerOne = pointsOfPlayerOne, PlayerTwo = pointsOfPlayerTwo
            };
            var score = Game.ScoreForPoints(points);

            return(new Game {
                Points = points,
                Score = score
            });
        }
Beispiel #8
0
 static string ScoreForPoints(GamePoints points)
 {
     return points.AreEqual()
     ? ScoreForPlayersEqual(points)
     : ScoreForPlayerLeading(points);
 }
Beispiel #9
0
 static string ScoreForPlayerLeadingInAdvantage(GamePoints points)
 {
     return points.IsAnyLeadingBy(2)
     ? points.IsPlayerOneLeading() ? "Game Player One" : "Game Player Two"
     : points.IsPlayerOneLeading() ? "Advantage Player One" : "Advantage Player Two";
 }
Beispiel #10
0
 public void Then_Is_Any_Above_Thirty_Is_True()
 {
     var points = new GamePoints { PlayerTwo = 3 };
       Assert.IsTrue(points.IsAnyAboveThirty());
 }
Beispiel #11
0
 static string ScoreForPlayerLeadingInAdvantage(GamePoints points)
 {
     return(points.IsAnyLeadingBy(2)
 ? points.IsPlayerOneLeading() ? "Game Player One" : "Game Player Two"
 : points.IsPlayerOneLeading() ? "Advantage Player One" : "Advantage Player Two");
 }
Beispiel #12
0
 static string ScoreForPoints(GamePoints points)
 {
     return(points.AreEqual()
 ? ScoreForPlayersEqual(points)
 : ScoreForPlayerLeading(points));
 }