public void Serving_player_looses_a_point() { // Arrange var servingPlayer = new Player("servingPlayer"); var receivingPlayer = new Player("receivingPlayer"); var game = new TennisGame(servingPlayer, receivingPlayer); // Act game.ServeFaulty().ServeFaulty(); // Assert Assert.Equal("Love - Fifteen", game.Score); }
public void Serving_player_gets_another_chance() { // Arrange var servingPlayer = new Player("servingPlayer"); var receivingPlayer = new Player("receivingPlayer"); var game = new TennisGame(servingPlayer, receivingPlayer); // Act game.ServeFaulty(); // Assert Assert.Equal("Love all", game.Score); }
protected GameState FaultyServe(GameState gamestate) { if (gamestate.GetType() == typeof(FirstServe)) { serving = game.ServeFaulty(); return(new SecondServe(gamestate)); } else { serving.ServeFaulty(); return(new FirstServe(gamestate)); } }
public void Scoring_happens_on_faulty_returns_or_double_servefaults() { // Arrange var servingPlayer = new Player("servingPlayer"); var receivingPlayer = new Player("receivingPlayer"); var game = new TennisGame(servingPlayer, receivingPlayer); // Act & assert 1st rally game.Serve().Return().Miss(); Assert.Equal("Love - Fifteen", game.Score); // Act & assert 2nd rally game.Serve().Miss(); Assert.Equal("Fifteen all", game.Score); // Act & assert 3rd rally game.ServeFaulty().ServeFaulty(); Assert.Equal("Fifteen - Thirty", game.Score); // Act & assert fourth rally game.Serve().Return().Return().Miss(); Assert.Equal("Thirty all", game.Score); }
private static void PlayerTwoScores(TennisGame game) { game.ServeFaulty().ServeFaulty(); }