Ejemplo n.º 1
0
        public ViewFactory()
        {
            _prototypes = new Dictionary <string, ViewProvider>();

            _prototypes["Startlist_1stRun_StartnumberAscending"] = new FirstRunStartListViewProvider();
            _prototypes["Startlist_1stRun_Points_0"]             = new DSVFirstRunStartListViewProvider(0);
            _prototypes["Startlist_1stRun_Points_15"]            = new DSVFirstRunStartListViewProvider(15);
            _prototypes["Startlist_1stRun_Points_30"]            = new DSVFirstRunStartListViewProvider(30);

            _prototypes["Startlist_2nd_StartnumberAscending"] = new SimpleSecondRunStartListViewProvider(StartListEntryComparer.Direction.Ascending);
            //_prototypes["Startlist_2nd_StartnumberAscending"] = new SimpleSecondRunStartListViewProvider(StartListEntryComparer.Direction.Ascending);
            _prototypes["Startlist_2nd_StartnumberDescending"] = new SimpleSecondRunStartListViewProvider(StartListEntryComparer.Direction.Descending);
            //_prototypes["Startlist_2nd_StartnumberDescending"] = new SimpleSecondRunStartListViewProvider(StartListEntryComparer.Direction.Descending);
            _prototypes["Startlist_2nd_PreviousRun_0_OnlyWithResults"]      = new BasedOnResultsFirstRunStartListViewProvider(0, false);
            _prototypes["Startlist_2nd_PreviousRun_0_AlsoWithoutResults"]   = new BasedOnResultsFirstRunStartListViewProvider(0, true);
            _prototypes["Startlist_2nd_PreviousRun_15_OnlyWithResults"]     = new BasedOnResultsFirstRunStartListViewProvider(15, false);
            _prototypes["Startlist_2nd_PreviousRun_15_AlsoWithoutResults"]  = new BasedOnResultsFirstRunStartListViewProvider(15, true);
            _prototypes["Startlist_2nd_PreviousRun_30_OnlyWithResults"]     = new BasedOnResultsFirstRunStartListViewProvider(30, false);
            _prototypes["Startlist_2nd_PreviousRun_30_AlsoWithoutResults"]  = new BasedOnResultsFirstRunStartListViewProvider(30, true);
            _prototypes["Startlist_2nd_PreviousRun_all_OnlyWithResults"]    = new BasedOnResultsFirstRunStartListViewProvider(int.MaxValue, false);
            _prototypes["Startlist_2nd_PreviousRun_all_AlsoWithoutResults"] = new BasedOnResultsFirstRunStartListViewProvider(int.MaxValue, true);

            _prototypes["RaceResult_BestOfTwo"]          = new RaceResultViewProvider(RaceResultViewProvider.TimeCombination.BestRun);
            _prototypes["RaceResult_Sum"]                = new RaceResultViewProvider(RaceResultViewProvider.TimeCombination.Sum);
            _prototypes["RaceResult_SumBest2"]           = new RaceResultViewProvider(RaceResultViewProvider.TimeCombination.SumBest2);
            _prototypes["RaceResult_SumDSVPointsSchool"] = new DSVSchoolRaceResultViewProvider();

            _prototypes["RaceRunResult"] = new RaceRunResultViewProvider();
        }
Ejemplo n.º 2
0
        public void RaceRun_IsComplete_ParticipantNotInStartlist()
        {
            TestDataGenerator tg = new TestDataGenerator();

            var race = tg.Model.GetRace(0);
            var run1 = race.GetRun(0);
            var run2 = race.GetRun(1);

            var frslVP = new FirstRunStartListViewProvider();

            frslVP.Init(race.GetParticipants());
            run1.SetStartListProvider(frslVP);

            var rVP = new RaceRunResultViewProvider();

            rVP.Init(run1, tg.Model);
            run1.SetResultViewProvider(rVP);

            var srslVP = new BasedOnResultsFirstRunStartListViewProvider(0, false);

            srslVP.Init(run1);
            run2.SetStartListProvider(srslVP);

            tg.createRaceParticipants(2);

            Assert.IsFalse(run1.IsComplete);
            //Assert.IsFalse(run2.IsComplete);

            // Run 1
            run1.SetRunTime(race.GetParticipant(1), new TimeSpan(0, 0, 0, 10, 0));
            Assert.IsFalse(run1.IsComplete);
            run1.SetResultCode(race.GetParticipant(2), RunResult.EResultCode.NaS);
            Assert.IsTrue(run1.IsComplete);

            // Run 2
            Assert.IsFalse(RaceRunUtil.IsComplete(run2));
            Assert.IsFalse(run2.IsComplete);
            run2.SetRunTime(race.GetParticipant(1), new TimeSpan(0, 0, 0, 10, 0));
            Assert.IsTrue(run2.IsComplete);
        }