Пример #1
0
        public void GamePlay_Side_One_Wins()
        {
            //Arrange
            determineWinner.Setup(w => w.ForPoint())
            .Returns(Side.One);

            //Act
            var result = target.Play();

            //Assert
            Assert.AreEqual(Side.One, result);
            Assert.AreEqual(5, target.GetPointScores().Count);
        }
Пример #2
0
        public Team Play()
        {
            _set       = new SetService();
            gameScores = new List <GameScore>
            {
                new GameScore {
                    Score = _set.GetScore()
                }
            };
            SetInitialServingTeam();

            while (_set.State != SetState.SetWonByTeamOne && _set.State != SetState.SetWonByTeamTwo)
            {
                var gameWinner = _playGame.Play();
                _set.Win(s => gameWinner);
                ToggleServingTeam();

                gameScores.Add(new GameScore
                {
                    Score       = _set.GetScore(),
                    PointScores = _playGame.GetPointScores()
                });
            }

            return(_set.State == SetState.SetWonByTeamOne ? Team.One : Team.Two);
        }
Пример #3
0
        public Side Play()
        {
            theSet     = new Set();
            gameScores = new List <GameScore>();
            gameScores.Add(new GameScore()
            {
                Score = theSet.PrintScore()
            });
            SetInitialServingSide();

            while (theSet.State != SetState.SetWonBySideOne && theSet.State != SetState.SetWonBySideTwo)
            {
                var gameWinner = playGame.Play();
                theSet.WinGame(s => gameWinner);
                ToggleServingSide();

                gameScores.Add(new GameScore()
                {
                    Score = theSet.PrintScore(), PointScores = playGame.GetPointScores()
                });
            }

            if (theSet.State == SetState.SetWonBySideOne)
            {
                return(Side.One);
            }
            else
            {
                return(Side.Two);
            }
        }