예제 #1
0
        /// <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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        /// <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);
                    }
                }
            }
        }
예제 #4
0
 public SetResult(TennisSet set, TennisGame remaining)
 {
     Set       = set;
     Remaining = remaining;
 }
예제 #5
0
 public vmSetScore(TennisSet _set)
 {
     Initialize(this, _set);
 }