public void WhenGameIsNotCompleteAndTryingToStartAnotherGameShouldThrow() { var set = new Set(); var game = set.AddGame(); game.ScoreP1(); Assert.Throws <ApplicationException>(() => set.AddGame(), "Cannot start a game while another game is in progress."); }
public void WhenTryToAddGameToCompletedSetShouldThrow() { var set = new Set(); for (int i = 0; i < NumberGamesToWin; i++) { var game = set.AddGame(); for (int j = 0; j < 4; j++) { game.ScoreP1(); } } Assert.Throws <ApplicationException>(() => set.AddGame(), "Cannot add a game. Set is complete."); }
public void When12GamesPlayedWithSixSixScoreThenShouldBeTieBreak() { var set = new Set(); for (int i = 0; i < NumberGamesToWin; i++) { var game = set.AddGame(); for (int j = 0; j < 4; j++) { game.ScoreP1(); } var game1 = set.AddGame(); for (int j = 0; j < 4; j++) { game1.ScoreP2(); } } Assert.IsTrue(set.IsTiebreak()); }
public void Correctly_outputs_1_nil() { var set = new Set(Player.One); var game = set.AddGame(Player.One); game.Points.Add(Player.One); game.Points.Add(Player.One); game.Points.Add(Player.One); game.Points.Add(Player.One); set.Score(Player.One).Should().Be("1-0"); }
public void Correctly_outputs_3_all() { var set = new Set(Player.One); for (int i = 0; i < 3; i++) { var game = set.AddGame(Player.One); game.Points.Add(Player.One); game.Points.Add(Player.One); game.Points.Add(Player.One); game.Points.Add(Player.One); game = set.AddGame(Player.One); game.Points.Add(Player.Two); game.Points.Add(Player.Two); game.Points.Add(Player.Two); game.Points.Add(Player.Two); } set.Score(Player.One).Should().Be("3-3"); }