Esempio n. 1
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);
        }