Exemplo 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));
        }
Exemplo 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));
        }
Exemplo 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));
        }
Exemplo 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));
        }
Exemplo 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);
 }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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));
        }
Exemplo 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));
        }
Exemplo 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);
 }
Exemplo 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));
        }
Exemplo 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));
        }
Exemplo 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));
        }
Exemplo 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));
        }
Exemplo 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);
 }
Exemplo 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));
        }
Exemplo 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));
        }
Exemplo 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);
 }
Exemplo 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);
 }
Exemplo 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);
            }
        }
Exemplo 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);
 }
Exemplo 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);
        }
Exemplo 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);
 }
Exemplo n.º 25
0
 public void SetupTennisGame()
 {
     _tennisGame = new TennisGame();
 }
Exemplo 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));
 }