Пример #1
0
        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());
        }
Пример #2
0
        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);
        }
Пример #3
0
        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());
        }