Esempio n. 1
0
        public void When_Love_Love_Then_Theres_No_Winner()
        {
            TennisGame game = new TennisGame(Score.Love, Score.Love);

            Assert.False(game.IsWinner(Player.One));
            Assert.False(game.IsWinner(Player.Two));
        }
Esempio n. 2
0
        public void When_Love_Love_Then_Score_Is_Love_Love()
        {
            TennisGame game = new TennisGame(Score.Love, Score.Love);

            Assert.Equal(Score.Love, game.GetScoreOf(Player.One));
            Assert.Equal(Score.Love, game.GetScoreOf(Player.Two));
        }
Esempio n. 3
0
        public void When_Love_Love_Then_Theres_No_Winner()
        {
            TennisGame game = new TennisGame(Score.Love, Score.Love);

            Assert.False(game.IsWinner(Player.One));
            Assert.False(game.IsWinner(Player.Two));
        }
Esempio n. 4
0
        public void When_Forty_Love_And_PlayerOne_Scores_Then_PlayerOne_Wins()
        {
            TennisGame game = new TennisGame(Score.Forty, Score.Love);
            game.GrantScoreTo(Player.One);

            Assert.True(game.IsWinner(Player.One));
        }
Esempio n. 5
0
 public void When_Deuce_And_PlayerOne_Scores_Twice_Then_Game_Is_Over()
 {
     TennisGame game = new TennisGame(Score.Forty, Score.Forty);
     game.GrantScoreTo(Player.One);
     game.GrantScoreTo(Player.One);
     Assert.True(game.IsOver);
 }
Esempio n. 6
0
        public void When_Forty_Love_And_PlayerTwo_Scores_Then_Game_Is_Not_Over()
        {
            TennisGame game = new TennisGame(Score.Forty, Score.Love);

            game.GrantScoreTo(Player.Two);
            Assert.False(game.IsOver);
        }
Esempio n. 7
0
        public void When_Deuce_And_PlayerOne_Scores_Then_Game_Is_Not_Over()
        {
            TennisGame game = new TennisGame(Score.Forty, Score.Forty);

            game.GrantScoreTo(Player.One);
            Assert.False(game.IsOver);
        }
Esempio n. 8
0
        public void When_Forty_Love_And_PlayerOne_Scores_Then_Game_Is_Over()
        {
            TennisGame game = new TennisGame(Score.Forty, Score.Love);

            game.GrantScoreTo(Player.One);
            Assert.True(game.IsOver);
        }
Esempio n. 9
0
        public void When_Love_Love_Then_Score_Is_Love_Love()
        {
            TennisGame game = new TennisGame(Score.Love, Score.Love);

            Assert.Equal(Score.Love, game.GetScoreOf(Player.One));
            Assert.Equal(Score.Love, game.GetScoreOf(Player.Two));
        }
Esempio n. 10
0
        public void When_Love_Forty_And_PlayerTwo_Scores_Then_PlayerTwo_Wins()
        {
            TennisGame game = new TennisGame(Score.Love, Score.Forty);
            game.GrantScoreTo(Player.Two);

            Assert.True(game.IsWinner(Player.Two));
        }
Esempio n. 11
0
 public void When_Deuce_And_PlayerOne_Scores_And_PlayerTwo_Scores_Then_Game_Is_Not_Over()
 {
     TennisGame game = new TennisGame(Score.Forty, Score.Forty);
     game.GrantScoreTo(Player.One);
     game.GrantScoreTo(Player.Two);
     Assert.False(game.IsOver);
 }
Esempio n. 12
0
        public void When_Love_Forty_And_PlayerTwo_Scores_Then_PlayerTwo_Wins()
        {
            TennisGame game = new TennisGame(Score.Love, Score.Forty);

            game.GrantScoreTo(Player.Two);

            Assert.True(game.IsWinner(Player.Two));
        }
Esempio n. 13
0
        public void When_Forty_Forty_And_PlayerOne_Scores_Then_Score_Is_Advantage_Forty()
        {
            TennisGame game = new TennisGame(Score.Forty, Score.Forty);
            game.GrantScoreTo(Player.One);

            Assert.Equal(Score.Advantage, game.GetScoreOf(Player.One));
            Assert.Equal(Score.Forty, game.GetScoreOf(Player.Two));
        }
Esempio n. 14
0
        public void When_Thirty_Forty_And_PlayerTwo_Scores_Then_Score_Is_Love_Game()
        {
            TennisGame game = new TennisGame(Score.Thirty, Score.Forty);
            game.GrantScoreTo(Player.Two);

            Assert.Equal(Score.Love, game.GetScoreOf(Player.One));
            Assert.Equal(Score.Game, game.GetScoreOf(Player.Two));
        }
Esempio n. 15
0
        public void When_Forty_Love_And_PlayerOne_Scores_Then_PlayerOne_Wins()
        {
            TennisGame game = new TennisGame(Score.Forty, Score.Love);

            game.GrantScoreTo(Player.One);

            Assert.True(game.IsWinner(Player.One));
        }
Esempio n. 16
0
 public void PlayerOne_should_not_wins_on_less_than_5_scores()
 {
     var game = new TennisGame();
     game.Win(game.PlayerOne);
     game.Win(game.PlayerOne);
     game.Win(game.PlayerOne);
     Assert.That(game.Finished, Is.False);
 }
Esempio n. 17
0
        public void When_Forty_Forty_And_PlayerOne_Scores_Then_Score_Is_Advantage_Forty()
        {
            TennisGame game = new TennisGame(Score.Forty, Score.Forty);

            game.GrantScoreTo(Player.One);

            Assert.Equal(Score.Advantage, game.GetScoreOf(Player.One));
            Assert.Equal(Score.Forty, game.GetScoreOf(Player.Two));
        }
Esempio n. 18
0
        public void When_Thirty_Forty_And_PlayerTwo_Scores_Then_Score_Is_Love_Game()
        {
            TennisGame game = new TennisGame(Score.Thirty, Score.Forty);

            game.GrantScoreTo(Player.Two);

            Assert.Equal(Score.Love, game.GetScoreOf(Player.One));
            Assert.Equal(Score.Game, game.GetScoreOf(Player.Two));
        }
Esempio n. 19
0
 public void PlayerOne_should_wins_on_5_scores()
 {
     var game = new TennisGame();
     game.Win(game.PlayerOne);
     game.Win(game.PlayerOne);
     game.Win(game.PlayerOne);
     game.Win(game.PlayerOne);
     game.Win(game.PlayerOne);
     Assert.That(game.Finished, Is.True);
 }
Esempio n. 20
0
 public void Game_should_finished_with_2_wins_on_fouty_fouty()
 {
     var game = new TennisGame();
     game.Win(game.PlayerOne);
     game.Win(game.PlayerTwo);
     game.Win(game.PlayerOne);
     game.Win(game.PlayerTwo);
     game.Win(game.PlayerOne);
     game.Win(game.PlayerTwo);
     game.Win(game.PlayerOne);
     game.Win(game.PlayerOne);
     Assert.That(game.PlayerOne.Points, Is.EqualTo(Points.Game));
     Assert.That(game.Finished, Is.True);
 }
Esempio n. 21
0
        void SimulateGame()
        {
            var game = new TennisGame();

            Console.WriteLine(game);

            for (var score = game.GetGameScore();
                 score.PlayerA != Score.Won && score.PlayerB != Score.Won;
                 score = game.GetGameScore())
            {
                var player = PickWinner();
                game.PromoteScore(player);
                Console.WriteLine(game);
            }
        }
Esempio n. 22
0
 public void Game_should_swaped_advantage_and_game_should_not_finished_()
 {
     var game = new TennisGame();
     game.Win(game.PlayerOne);
     game.Win(game.PlayerTwo);
     game.Win(game.PlayerOne);
     game.Win(game.PlayerTwo);
     game.Win(game.PlayerOne);
     game.Win(game.PlayerTwo);
     game.Win(game.PlayerOne);
     game.Win(game.PlayerTwo);
     game.Win(game.PlayerOne);
     game.Win(game.PlayerTwo);
     game.Win(game.PlayerOne);
     game.Win(game.PlayerTwo);
     Assert.That(game.PlayerOne.Points, Is.EqualTo(Points.Forty));
     Assert.That(game.Finished, Is.False);
 }
Esempio n. 23
0
        public void When_Love_Love_Then_Game_Is_Not_Over()
        {
            TennisGame game = new TennisGame(Score.Love, Score.Love);

            Assert.False(game.IsOver);
        }
Esempio n. 24
0
 public void When_Love_Love_Then_Game_Is_Not_Over()
 {
     TennisGame game = new TennisGame(Score.Love, Score.Love);
     Assert.False(game.IsOver);
 }
Esempio n. 25
0
 public void SetupTennisGame()
 {
     _tennisGame = new TennisGame();
 }
Esempio n. 26
0
 public void Game_Init_should_0_point_on_game_start()
 {
     var game = new TennisGame();
     Assert.That(game.PlayerOne.Points, Is.EqualTo(Points.Love));
     Assert.That(game.PlayerTwo.Points, Is.EqualTo(Points.Love));
 }