private void CheckAllScores(ITennisGame game) { var highestScore = Math.Max(this.player1Score, this.player2Score); for (var i = 0; i < highestScore; i++) { if (i < this.player1Score) { game.Player1WonPoint(); } if (i < this.player2Score) { game.Player2WonPoint(); } } Assert.AreEqual(this.expectedScore, game.GetScore()); }
private void RealisticTennisGame(ITennisGame game) { string[] points = { "player1", "player1", "player2", "player2", "player1", "player1" }; string[] expectedScores = { "Fifteen-Love", "Thirty-Love", "Thirty-Fifteen", "Thirty-All", "Forty-Thirty", "Win for player1" }; for (var i = 0; i < 6; i++) { if (points[i].Equals("player1")) { game.Player1WonPoint(); } else { game.Player2WonPoint(); } Assert.AreEqual(expectedScores[i], game.GetScore()); } }