Esempio n. 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());
        }
Esempio n. 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);
        }
Esempio n. 3
0
        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();
            }
        }
Esempio n. 4
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());
        }
Esempio n. 5
0
        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;
            }
        }
Esempio n. 6
0
 public void Setup()
 {
     target = new Game();
 }
Esempio n. 7
0
 public void TearDown()
 {
     target = null;
 }
Esempio n. 8
-1
 public void SetUp()
 {
     game = new Game();
 }