public void When_Players_Are_In_Deuce_One_Player_Scores(TennisPlayer player)
        {
            TennisGame game = new TennisGame();

            TennisPlayer otherPlayer = TennisPlayer.PlayerA;
            if (player == TennisPlayer.PlayerA)
                otherPlayer = TennisPlayer.PlayerB;

            game.Score(player);
            game.Score(player);
            game.Score(player);

            game.Score(otherPlayer);
            game.Score(otherPlayer);
            game.Score(otherPlayer);

            game.Score(otherPlayer);

            Assert.That(game.Points(otherPlayer), Is.EqualTo(TennisScore.Advantage));
        }
        public void When_PlayerA_Scores_Two_Times_Then_PlayerA_Has_30()
        {
            TennisGame game = new TennisGame();

            game.Score(TennisPlayer.PlayerA);
            game.Score(TennisPlayer.PlayerA);

            Assert.That(game.PointsA, Is.EqualTo(TennisScore.Thirty));
        }
        public void When_PlayerB_Scores_Starting_With_Zero_Then_PlayerB_Has_15()
        {
            TennisGame game = new TennisGame();

            game.Score(TennisPlayer.PlayerB);

            Assert.That(game.PointsB, Is.EqualTo(TennisScore.Fifteen));
        }
        public void When_PlayerA_scores_4times_PointsA_Equals_Game(TennisPlayer player)
        {
            TennisGame game = new TennisGame();

            game.Score(player);
            game.Score(player);
            game.Score(player);
            game.Score(player);

            Assert.That(game.Points(player), Is.EqualTo(TennisScore.Game));
        }
        public void When_PlayerA_has_40_and_PlayerB_has_40_PlayerA_scores_to_advantage()
        {
            TennisGame game = new TennisGame();

            game.Score(TennisPlayer.PlayerA);
            game.Score(TennisPlayer.PlayerA);
            game.Score(TennisPlayer.PlayerA);

            game.Score(TennisPlayer.PlayerB);
            game.Score(TennisPlayer.PlayerB);
            game.Score(TennisPlayer.PlayerB);

            game.Score(TennisPlayer.PlayerA);

            Assert.That(game.PointsA, Is.EqualTo(TennisScore.Advantage));
        }
 public void When_Each_Player_Have_No_Points_Then_Game_Is_Not_Over()
 {
     TennisGame game = new TennisGame();
     bool isOver = game.IsGameOver;
     Assert.That(isOver, Is.False);
 }
        public void When_A_Player_Scores_Four_Times_Then_Game_Is_Over()
        {
            TennisGame game = new TennisGame();

            game.Score(TennisPlayer.PlayerA);
            game.Score(TennisPlayer.PlayerA);
            game.Score(TennisPlayer.PlayerA);
            game.Score(TennisPlayer.PlayerA);

            bool isOver = game.IsGameOver;
            Assert.That(isOver, Is.True);
        }
 public void PointsB_Player_B_Starts_With_Zero_Points()
 {
     TennisGame game = new TennisGame();
     Assert.AreEqual(TennisScore.Love, game.PointsB);
 }