public void SendScore_WhenGameIsComplete_ShouldBeCalled() { DummyReportingService reportingService = new DummyReportingService(); Game game = new Game(reportingService); ScorePoints(game, 4, 2); var score = game.GetScore(); Assert.IsTrue(reportingService.SendScoreWasCalled()); }
public void GameIsComplete_WhenThereIsAWinner_ReturnsTrue() { IReportingService reportingService = new DummyReportingService(); Game gameWithReportingService = new Game(reportingService); ScorePoints(gameWithReportingService, 4, 2); var score = gameWithReportingService.GetScore(); Assert.AreEqual(true, gameWithReportingService.GameIsComplete); }
private void ScorePoints(Game game, int numberOfPlayer1Points, int numberOfPlayer2Points) { for (int i = 0; i < numberOfPlayer1Points; i++) { game.Player1.ScorePoint(); } for (int i = 0; i < numberOfPlayer2Points; i++) { game.Player2.ScorePoint(); } }
public void GetScore_WithValidPoints_ReturnsCorrectScore(int numberOfPlayer1Points, int numberOfPlayer2Points, string expected) { IReportingService reportingService = new DummyReportingService(); Game gameWithReportingService = new Game(reportingService); for (int i = 0; i < numberOfPlayer1Points; i++) { gameWithReportingService.Player1.ScorePoint(); } for (int i = 0; i < numberOfPlayer2Points; i++) { gameWithReportingService.Player2.ScorePoint(); } Assert.AreEqual(expected, gameWithReportingService.GetScore()); }
public Side Play() { game = new Game(); pointScores = new List<string>(); pointScores.Add(game.PrintScore()); while(game.State != GameState.GameWonBySideOne && game.State != GameState.GameWonBySideTwo) { var side = determineWinner.ForPoint(); game.WinPoint(s => side); pointScores.Add(game.PrintScore()); } if (game.State == GameState.GameWonBySideOne) { return Side.One; } else { return Side.Two; } }
public void Setup() { target = new Game(); }
public void TearDown() { target = null; }
public void SetUp() { game = new Game(); }