public void RealisticTennisGame() { TennisGame game = new TennisGame(0, 0); Assert.AreEqual("Love-Love", game.GetScore()); string[] points = { "player1", "player1", "player2", "player2", "player1", "player1" }; string[] expectedScores = { "Fifteen-Love", "Thirty-Love", "Thirty-Fifteen", "Thirty-Thirty", "Forty-Thirty", "Win Player1" }; for (int i = 0; i < expectedScores.Length; i++) { game.WonPoint(points[i]); Assert.AreEqual(expectedScores[i], game.GetScore()); } }
public void GetScore_ShouldShouldReturnExpectedValue(int player1ScoredCount, int player2ScoredCount, string score) { //Arrange var player1 = new Player("Player1"); var player2 = new Player("Player2"); var game = new TennisGame(player1, player2); //Act int i = 0, j = 0; for (; i < player1ScoredCount || j < player2ScoredCount; j++, i++) { if (i < player1ScoredCount) { game.PlayerScored(player1); } if (j < player2ScoredCount) { game.PlayerScored(player2); } } var result = game.GetScore(); //Assert result.ShouldBe(score); }
public void PlayerOneScorePoint15Love() { var tennisGame = new TennisGame(); tennisGame.PlayerOneScore(1); Assert.Equal("15 love", tennisGame.GetScore()); }
public void PlayerOneScoreTwoPoints30Love() { var tennisGame = new TennisGame(); tennisGame.PlayerOneScore(2); Assert.Equal("30 love", tennisGame.GetScore()); }
public void PlayerOneScoreThreePoints40Love() { var tennisGame = new TennisGame(); tennisGame.PlayerOneScore(3); Assert.Equal("40 love", tennisGame.GetScore()); }
public void PlayerTwoScoreOnePointLove30() { var tennisGame = new TennisGame(); tennisGame.PlayerTwoScore(2); Assert.Equal("love 30", tennisGame.GetScore()); }
public void AdvantagePlayerTwo() { var tennisGame = new TennisGame(); tennisGame.PlayerOneScore(4); tennisGame.PlayerTwoScore(5); Assert.Equal("advantage player2", tennisGame.GetScore()); }
public void WinnerPlayerTwo() { var tennisGame = new TennisGame(); tennisGame.PlayerOneScore(2); tennisGame.PlayerTwoScore(4); Assert.Equal("winner player2", tennisGame.GetScore()); }
public void BothScoreTwice() { var tennisGame = new TennisGame(); tennisGame.PlayerOneScore(2); tennisGame.PlayerTwoScore(2); Assert.Equal("30 all", tennisGame.GetScore()); }
public void DeuceThreePoints() { var tennisGame = new TennisGame(); tennisGame.PlayerOneScore(3); tennisGame.PlayerTwoScore(3); Assert.Equal("deuce", tennisGame.GetScore()); }
public void RealisticTennisGame(TennisGame game) { String[] points = { "player1", "player1", "player2", "player2", "player1", "player1" }; String[] expected_scores = { "Fifteen-Love", "Thirty-Love", "Thirty-Fifteen", "Thirty-All", "Forty-Thirty", "Win for player1" }; for (int i = 0; i < 6; i++) { game.WonPoint(points[i]); Assert.AreEqual(expected_scores[i], game.GetScore()); } }
public void TestScore(int playerAScore, int playerBScore, string score) { TennisGame tennisGame = new TennisGame() { PlayerAScore = playerAScore, PlayerBScore = playerBScore }; Assert.AreEqual(score, tennisGame.GetScore()); }
public void GetScore_Start_ShouldbeLoveAll() { //Arrange var player1 = new Player("Player1"); var player2 = new Player("Player2"); var game = new TennisGame(player1, player2); //Act var score = game.GetScore(); //Assert score.ShouldBe("love all"); }
public void Tennis_game_score_for_different_point_combinations( int playerOneScore, int playerTwoScore, string expected) { // Arrange var sut = new TennisGame(playerOneScore, playerTwoScore); // Act var result = sut.GetScore(); // Assert result.Should().Be(expected); }
public void GetScore_Start_Shouldbe15Love() { //Arrange var player1 = new Player("Player1"); var player2 = new Player("Player2"); var game = new TennisGame(player1, player2); //Act game.PlayerScored(player1); var score = game.GetScore(); //Assert score.ShouldBe("15-love"); }
public void checkAllScores(TennisGame game) { int highestScore = Math.Max(this.player1Score, this.player2Score); for (int i = 0; i < highestScore; i++) { if (i < this.player1Score) { game.WonPoint("player1"); } if (i < this.player2Score) { game.WonPoint("player2"); } } Assert.AreEqual(this.expectedScore, game.GetScore()); }
public void GetScore_ShouldBeDeuse(int score) { //Arrange var player1 = new Player("Player1"); var player2 = new Player("Player2"); var game = new TennisGame(player1, player2); //Act for (int i = 0; i < score; i++) { game.PlayerScored(player1); game.PlayerScored(player2); } var result = game.GetScore(); //Assert result.ShouldBe("deuse"); }
public void GetScore_Player2ShouldWinWithoutDeuse() { //Arrange var player1 = new Player("Player1"); var player2 = new Player("Player2"); var game = new TennisGame(player1, player2); //Act game.PlayerScored(player2); game.PlayerScored(player1); game.PlayerScored(player2); game.PlayerScored(player2); game.PlayerScored(player1); game.PlayerScored(player2); var result = game.GetScore(); //Assert result.ShouldBe("Player2 win"); }
public void GetScore_Player2ShouldBeInAdvantage(int player2Score) { //Arrange var player1 = new Player("Player1"); var player2 = new Player("Player2"); var game = new TennisGame(player1, player2); //Act for (int i = 0; i < player2Score; i++) { game.PlayerScored(player1); game.PlayerScored(player2); } game.PlayerScored(player2); var result = game.GetScore(); //Assert result.ShouldBe("Player2 advantage"); }
public void GetScore_ShouldReturnDeuce_WhenScoreIs6And6() { TennisGame game = new TennisGame(6, 6); Assert.AreEqual("Deuce", game.GetScore()); }
public void GetScore_ShouldReturnLoveLove_WhenScoreIs0And0() { TennisGame game = new TennisGame(0, 0); Assert.AreEqual("Love-Love", game.GetScore()); }
public void GetScore_ShouldReturnWinPlayer1_WhenScoreIs4And2() { TennisGame game = new TennisGame(4, 2); Assert.AreEqual("Win Player1", game.GetScore()); }
public void GetScore_ShouldReturnDeuce_WhenScoreIs6And6() { TennisGame game = new TennisGame(6, 6); Assert.AreEqual("Deuce", game.GetScore()); }
public void GetScore_ShouldReturnFortyLove_WhenScoreIs3And0() { TennisGame game = new TennisGame(3, 0); Assert.AreEqual("Forty-Love", game.GetScore()); }
public void GetScore_ShouldReturnWinPlayer1_WhenScoreIs4And2() { TennisGame game = new TennisGame(4, 2); Assert.AreEqual("Win Player1", game.GetScore()); }
public void GetScore_ShouldReturnThirtyThirty_WhenScoreIs2And2() { TennisGame game = new TennisGame(2, 2); Assert.AreEqual("Thirty-Thirty", game.GetScore()); }
public void GetScore_ShouldReturnThirtyLove_WhenScoreIs2And0() { TennisGame game = new TennisGame(2, 0); Assert.AreEqual("Thirty-Love", game.GetScore()); }
public void GetScore_ShouldReturnAdvPlayer1_WhenScoreIs4And5() { TennisGame game = new TennisGame(4, 5); Assert.AreEqual("Adv Player2", game.GetScore()); }
public void RealisticTennisGame() { TennisGame game = new TennisGame(0, 0); Assert.AreEqual("Love-Love", game.GetScore()); string[] points = { "player1", "player1", "player2", "player2", "player1", "player1" }; string[] expectedScores = { "Fifteen-Love", "Thirty-Love", "Thirty-Fifteen", "Thirty-Thirty", "Forty-Thirty", "Win Player1" }; for (int i = 0; i < expectedScores.Length; i++) { game.WonPoint(points[i]); Assert.AreEqual(expectedScores[i], game.GetScore()); } }
public void GetScore_ShouldReturnFifteenLove_WhenScoreIs1And0() { TennisGame game = new TennisGame(1, 0); Assert.AreEqual("Fifteen-Love", game.GetScore()); }
public void GetScore_ShouldReturnThirtyThirty_WhenScoreIs2And2() { TennisGame game = new TennisGame(2, 2); Assert.AreEqual("Thirty-Thirty", game.GetScore()); }
public void GetScore_ShouldReturnLoveFifteen_WhenScoreIs0And1() { TennisGame game = new TennisGame(0, 1); Assert.AreEqual("Love-Fifteen", game.GetScore()); }
public void GetScore_ShouldReturnWinPlayer2_WhenScoreIs2And4() { TennisGame game = new TennisGame(2, 4); Assert.AreEqual("Win Player2", game.GetScore()); }
public void GetScore_ShouldReturnFifteenLove_WhenScoreIs1And0() { TennisGame game = new TennisGame(1, 0); Assert.AreEqual("Fifteen-Love", game.GetScore()); }
public void GetScore_ShouldReturnAdvPlayer1_WhenScoreIs4And5() { TennisGame game = new TennisGame(4, 5); Assert.AreEqual("Adv Player2", game.GetScore()); }
public void GetScore_ShouldReturnWinPlayer2_WhenScoreIs2And4() { TennisGame game = new TennisGame(2, 4); Assert.AreEqual("Win Player2", game.GetScore()); }
public void NewGameLoveAll() { var tennisGame = new TennisGame(); Assert.Equal("love all", tennisGame.GetScore()); }
public void GetScore_ShouldReturnLoveFifteen_WhenScoreIs0And1() { TennisGame game = new TennisGame(0, 1); Assert.AreEqual("Love-Fifteen", game.GetScore()); }
public void GetScore_ShouldReturnAdvPlayer2_WhenScoreIs5And4() { TennisGame game = new TennisGame(5, 4); Assert.AreEqual("Adv Player1", game.GetScore()); }
public void Start_With_A_Score_Of_Love_All() { var score = _tennisGame.GetScore(); Assert.That(score, Is.EqualTo("love-love")); }
public void GetScore_ShouldReturnLoveLove_WhenScoreIs0And0() { TennisGame game = new TennisGame(0, 0); Assert.AreEqual("Love-Love", game.GetScore()); }