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)); }
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)); }
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)); }
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); }
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); }
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); }
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); }
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)); }
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); }
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)); }
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)); }
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); }
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); }
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); }
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); } }
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); }
public void When_Love_Love_Then_Game_Is_Not_Over() { TennisGame game = new TennisGame(Score.Love, Score.Love); Assert.False(game.IsOver); }
public void SetupTennisGame() { _tennisGame = new TennisGame(); }
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)); }