Inheritance: ScoringContext
Example #1
0
 public ISetState GetDecidingSetState(TennisSet set)
 {
     return new SetStateTieBreakScoring(set);
 }
Example #2
0
 public ISetState GetStandardSetState(TennisSet set)
 {
     return new SetStateTieBreakScoring(set);
 }
Example #3
0
        public void AddPoint(Party party)
        {
            if (_matchState.MatchOver)
                throw new InvalidOperationException("Cannot add points to won matches.");

            _currentSet.AddPoint(party);

            if (_currentSet.SetOver)
            {
                IncreaseScore(party);
                _matchState = _matchState.SetAdded(party);

                if (!_matchState.MatchOver)
                    _currentSet = _matchState.GetNextSet(_tournamentRules);
            }
        }
Example #4
0
 public ISetState GetDecidingSetState(TennisSet set)
 {
     return new SetStateAdvantageScoring(set);
 }
Example #5
0
 public TennisMatch(ITournamentRules tournamentRules, Func<TennisMatch, IMatchState> matchStateFactory)
     : base(new Party("A"), new Party("B"))
 {
     _tournamentRules = tournamentRules;
     _matchState = matchStateFactory(this);
     _currentSet = _matchState.GetNextSet(tournamentRules);
 }
Example #6
0
 public SetStateWon(TennisSet set, Party winningParty)
 {
     _set = set;
     _winningParty = winningParty;
 }
Example #7
0
 public SetStateTieBreakScoring(TennisSet set)
     : base(set)
 {
 }
Example #8
0
 protected SetStateBase(TennisSet set)
 {
     Set = set;
 }
Example #9
0
 public SetStateAdvantageScoring(TennisSet set)
     : base(set)
 {
 }