Example #1
0
        public override string ToString()
        {
            if (_gameScorer.HasWinner())
            {
                return(string.Format("{0} wins!", _gameScorer.Winner.Name));
            }

            if (_gameScorer.AnyPlayerHasAdvantage())
            {
                return(string.Format("Advantage {0}", _gameScorer.Advantage.Name));
            }

            int score1 = _gameScorer.Player1.Score;
            int score2 = _gameScorer.Player2.Score;

            if (score1 == 40 && score2 == 40)
            {
                return("Deuce");
            }

            if (score1 == score2)
            {
                return(string.Format("{0}-all", _scoreWord[score1]));
            }

            return(string.Format(
                       "{0} - {1}",
                       _scoreWord[score1],
                       _scoreWord[score2]
                       ));
        }