/// <summary> /// Add a new set to the collection (event handler) /// </summary> /// <param name="sender"></param> /// <param name="_newSet"></param> void Match_NewSet(object sender, TennisSet _newSet) { vmStatistics newStatistics = new vmStatistics(String.Format("Set {0}", this.Children.Count), _newSet.Statistics, this); newStatistics.Selected += newStatistics_Selected; Children.Add(newStatistics); }
public void SetUp() { _tennisPointWinnerService = new Mock <ITennisPointWinnerService>(); _serviceFactory = new Mock <ITennisServiceFactory>(_tennisPointWinnerService.Object); _gameService = new Mock <TennisGame>(_serviceFactory.Object); _sut = new TennisSet(_serviceFactory.Object); _serviceFactory.Setup(x => x.GetGameService()).Returns(_gameService.Object); }
/// <summary> /// Initialize an instance with the contents of a tennisset /// </summary> /// <param name="instance"></param> /// <param name="set"></param> public static void Initialize(vmSetScore instance, TennisSet set) { instance.Score1 = set.ScoreContestant1.ToString(); instance.Score2 = set.ScoreContestant2.ToString(); instance.Index = set.PartOf.Sets.IndexOf(set) + 1; instance.InProgress = (set.Winner == 0); if (set.Games.Count > 1) { TennisGame LastGame = set.Games[set.Games.Count - 1]; if (LastGame.GetType() == typeof(TennisTiebreak)) { instance.IsTiebreak = true; if (!instance.InProgress) { instance.Score1Tiebreak = LastGame.getScoreContestant(1); instance.Score2Tiebreak = LastGame.getScoreContestant(2); } } } }
public SetResult(TennisSet set, TennisGame remaining) { Set = set; Remaining = remaining; }
public vmSetScore(TennisSet _set) { Initialize(this, _set); }