Exemplo n.º 1
0
        public void HandTimingsVM_DeleteHandTiming()
        {
            TestDataGenerator tg   = new TestDataGenerator();
            HandTimingVM      htVM = new HandTimingVM(HandTimingVMEntry.ETimeModus.EStartTime);

            List <RunResult> rr1 = new List <RunResult>
            {
                tg.createRunResult(tg.createRaceParticipant(), new TimeSpan(0, 8, 0, 2), new TimeSpan(0, 8, 1, 2))
            };

            List <TimingData> hts1 = new List <TimingData>
            {
                new TimingData {
                    Time = new TimeSpan(0, 8, 0, 2, 301)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 5, 2, 300)
                }
            };

            htVM.AddRunResults(rr1);
            htVM.AddHandTimings(hts1);

            Assert.AreEqual(2, htVM.Items.Count);

            htVM.DeleteHandTimings();

            Assert.AreEqual(1, htVM.Items.Count);
            Assert.IsNull(htVM.Items[0].HandTime);
            Assert.IsNotNull(htVM.Items[0].StartTime);
        }
Exemplo n.º 2
0
        public void HandTimingsVM()
        {
            string dbFilename = TestUtilities.CreateWorkingFileFrom(testContextInstance.TestDeploymentDir, @"1557MRBR_RH.mdb");
            string hsFilename = @"--Handzeit-Start.txt";
            string hfFilename = @"--Handzeit-Ziel.txt";

            Database db = new Database();

            db.Connect(dbFilename);
            AppDataModel model = new AppDataModel(db);

            FromFileHandTiming hsTiming = new FromFileHandTiming(hsFilename);
            FromFileHandTiming hfTiming = new FromFileHandTiming(hfFilename);

            hsTiming.Connect();
            hfTiming.Connect();

            List <TimingData> hsList = new List <TimingData>(hsTiming.TimingData());
            List <TimingData> hfList = new List <TimingData>(hfTiming.TimingData());


            HandTimingVM htVM = new HandTimingVM(HandTimingVMEntry.ETimeModus.EStartTime);

            htVM.AddRunResults(model.GetRace(0).GetRun(0).GetResultList());
            htVM.AddHandTimings(hsList);
        }
Exemplo n.º 3
0
        public void HandTimingCalc_Report()
        {
            TestDataGenerator tg   = new TestDataGenerator();
            HandTimingVM      htVM = new HandTimingVM(HandTimingVMEntry.ETimeModus.EStartTime);

            List <RunResult> rr1 = new List <RunResult>
            {
                tg.createRunResult(tg.createRaceParticipant(), new TimeSpan(0, 8, 0, 0), new TimeSpan(0, 8, 0, 10)),
                tg.createRunResult(tg.createRaceParticipant(), new TimeSpan(0, 8, 1, 0), new TimeSpan(0, 8, 1, 20)),
                tg.createRunResult(tg.createRaceParticipant(), new TimeSpan(0, 8, 2, 0), new TimeSpan(0, 8, 2, 30)),
                tg.createRunResult(tg.createRaceParticipant(), new TimeSpan(0, 8, 3, 0), new TimeSpan(0, 8, 3, 40)),
                tg.createRunResult(tg.createRaceParticipant(), new TimeSpan(0, 8, 4, 0), new TimeSpan(0, 8, 4, 50)),
                tg.createRunResult(tg.createRaceParticipant(), null, new TimeSpan(0, 8, 5, 45))
            };

            List <TimingData> hts1 = new List <TimingData>
            {
                new TimingData {
                    Time = new TimeSpan(0, 8, 0, 0, 100)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 1, 0, 200)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 2, 0, 300)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 3, 0, 100)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 4, 0, 200)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 5, 0, 300)
                }
            };

            htVM.AddRunResults(rr1);
            htVM.AddHandTimings(hts1);

            htVM.AssignStartNumber(htVM.Items[5], 6);

            HandTimingCalc hc = new HandTimingCalc(htVM.Items[5], htVM.Items);

            IPDFReport report = new HandTimingCalcReport(hc, tg.Model.GetRace(0));

            Assert.IsTrue(TestUtilities.GenerateAndCompareAgainstPdf(TestContext, report, @"HandTimingCalc_Report.pdf", 1));
        }
Exemplo n.º 4
0
        public void HandTimingsVM_Correlation()
        {
            TestDataGenerator tg = new TestDataGenerator();

            HandTimingVM htVM = new HandTimingVM(HandTimingVMEntry.ETimeModus.EStartTime);

            List <RunResult> rr1 = new List <RunResult>
            {
                tg.createRunResult(tg.createRaceParticipant(), new TimeSpan(0, 8, 0, 2), new TimeSpan(0, 8, 1, 2)),
                tg.createRunResult(tg.createRaceParticipant(), new TimeSpan(0, 8, 2, 2), new TimeSpan(0, 8, 3, 2)),
                tg.createRunResult(tg.createRaceParticipant(), new TimeSpan(0, 8, 4, 2), null)
            };

            List <TimingData> hts1 = new List <TimingData>
            {
                new TimingData {
                    Time = new TimeSpan(0, 8, 0, 2, 301)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 2, 1, 299)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 2, 1, 300)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 4, 2, 1)
                }
            };

            htVM.AddRunResults(rr1);
            htVM.AddHandTimings(hts1);

            Assert.AreEqual(new TimeSpan(0, 8, 0, 2), htVM.Items[0].ATime);
            Assert.AreEqual(new TimeSpan(0, 8, 0, 2, 301), htVM.Items[0].HandTime);
            Assert.AreEqual(new TimeSpan(0, 0, 0, 0, 300), htVM.Items[0].HandTimeDiff);

            Assert.IsNull(htVM.Items[1].ATime);
            Assert.AreEqual(new TimeSpan(0, 8, 2, 1, 300), htVM.Items[1].HandTime);
            Assert.IsNull(htVM.Items[1].HandTimeDiff);

            Assert.AreEqual(new TimeSpan(0, 8, 2, 2), htVM.Items[2].ATime);
            Assert.AreEqual(new TimeSpan(0, 8, 2, 1, 299), htVM.Items[2].HandTime);
            Assert.AreEqual(new TimeSpan(0, 0, 0, 0, -710), htVM.Items[2].HandTimeDiff);

            Assert.AreEqual(new TimeSpan(0, 8, 4, 2), htVM.Items[3].ATime);
            Assert.AreEqual(new TimeSpan(0, 8, 4, 2, 1), htVM.Items[3].HandTime);
            Assert.AreEqual(new TimeSpan(0, 0, 0, 0, 0), htVM.Items[3].HandTimeDiff);
        }
Exemplo n.º 5
0
        public void HandTimingCalc_Test3()
        {
            TestDataGenerator tg   = new TestDataGenerator();
            HandTimingVM      htVM = new HandTimingVM(HandTimingVMEntry.ETimeModus.EFinishTime);

            List <RunResult> rr1 = new List <RunResult>
            {
                tg.createRunResult(tg.createRaceParticipant(), null, new TimeSpan(0, 8, 0, 0)),
                tg.createRunResult(tg.createRaceParticipant(), null, new TimeSpan(0, 8, 1, 0)),
                tg.createRunResult(tg.createRaceParticipant(), null, new TimeSpan(0, 8, 2, 0)),
                tg.createRunResult(tg.createRaceParticipant(), null, new TimeSpan(0, 8, 3, 0)),
                tg.createRunResult(tg.createRaceParticipant(), null, new TimeSpan(0, 8, 4, 0)),
                tg.createRunResult(tg.createRaceParticipant(), null, null)
            };

            List <TimingData> hts1 = new List <TimingData>
            {
                new TimingData {
                    Time = new TimeSpan(0, 8, 0, 0, 100)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 1, 0, 200)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 2, 0, 300)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 3, 0, 100)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 4, 0, 200)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 5, 0, 300)
                }
            };

            htVM.AddRunResults(rr1);
            htVM.AddHandTimings(hts1);

            htVM.AssignStartNumber(htVM.Items[5], 6);

            HandTimingCalc hc = new HandTimingCalc(htVM.Items[5], htVM.Items);

            Assert.AreEqual(new TimeSpan(0, 8, 5, 0, 120), hc.CalculatedTime);
        }
Exemplo n.º 6
0
        public void HandTimingsVM_Dissolve()
        {
            TestDataGenerator tg = new TestDataGenerator();

            HandTimingVM htVM = new HandTimingVM(HandTimingVMEntry.ETimeModus.EStartTime);

            List <RunResult> rr1 = new List <RunResult>
            {
                tg.createRunResult(tg.createRaceParticipant(), new TimeSpan(0, 8, 0, 2), new TimeSpan(0, 8, 1, 2))
            };

            List <TimingData> hts1 = new List <TimingData>
            {
                new TimingData {
                    Time = new TimeSpan(0, 8, 0, 2, 301)
                }
            };

            htVM.AddRunResults(rr1);
            htVM.AddHandTimings(hts1);

            // Check Pre-Condition
            Assert.AreEqual(new TimeSpan(0, 8, 0, 2), htVM.Items[0].ATime);
            Assert.AreEqual(new TimeSpan(0, 8, 0, 2, 301), htVM.Items[0].HandTime);
            Assert.AreEqual(new TimeSpan(0, 0, 0, 0, 300), htVM.Items[0].HandTimeDiff);

            // Operation
            htVM.Dissolve(htVM.Items[0]);

            // Check Post-Condition
            Assert.AreEqual(new TimeSpan(0, 8, 0, 2), htVM.Items[0].ATime);
            Assert.IsNull(htVM.Items[0].HandTime);
            Assert.IsNull(htVM.Items[0].HandTimeDiff);

            Assert.IsNull(htVM.Items[1].ATime);
            Assert.AreEqual(new TimeSpan(0, 8, 0, 2, 301), htVM.Items[1].HandTime);
            Assert.IsNull(htVM.Items[1].HandTimeDiff);
        }
Exemplo n.º 7
0
        public void HandTimingsVM_AssignStartNumber()
        {
            TestDataGenerator tg = new TestDataGenerator();

            HandTimingVM htVM = new HandTimingVM(HandTimingVMEntry.ETimeModus.EStartTime);

            List <RunResult> rr1 = new List <RunResult>
            {
                tg.createRunResult(tg.createRaceParticipant(), null, new TimeSpan(0, 8, 1, 2))
            };

            List <TimingData> hts1 = new List <TimingData>
            {
                new TimingData {
                    Time = new TimeSpan(0, 8, 0, 2, 301)
                },
                new TimingData {
                    Time = new TimeSpan(0, 8, 5, 2, 300)
                }
            };

            htVM.AddRunResults(rr1);
            htVM.AddHandTimings(hts1);

            // ***** Case 1: Merge entries ****

            // Check Pre-Condition
            Assert.IsNull(htVM.Items[0].ATime);
            Assert.AreEqual(new TimeSpan(0, 8, 0, 2, 301), htVM.Items[0].HandTime);
            Assert.IsNull(htVM.Items[0].HandTimeDiff);

            Assert.AreEqual(1U, htVM.Items[2].StartNumber);
            Assert.IsNull(htVM.Items[2].ATime);
            Assert.IsNull(htVM.Items[2].HandTime);
            Assert.IsNull(htVM.Items[2].HandTimeDiff);

            Assert.AreEqual(3, htVM.Items.Count);

            // Operation
            htVM.AssignStartNumber(htVM.Items[0], 1);

            // Check Post-Condition
            Assert.AreEqual(1U, htVM.Items[0].StartNumber);
            Assert.IsNull(htVM.Items[0].ATime);
            Assert.AreEqual(new TimeSpan(0, 8, 0, 2, 301), htVM.Items[0].HandTime);
            Assert.IsNull(htVM.Items[0].HandTimeDiff);
            Assert.IsNull(htVM.Items[0].StartTime);
            Assert.AreEqual(new TimeSpan(0, 8, 1, 2), htVM.Items[0].FinishTime);

            Assert.AreEqual(2, htVM.Items.Count);



            // ***** Case 2: Adjust entry ****

            // Check Pre-Condition
            Assert.IsNull(htVM.Items[1].StartNumber);
            Assert.IsNull(htVM.Items[1].ATime);
            Assert.AreEqual(new TimeSpan(0, 8, 5, 2, 300), htVM.Items[1].HandTime);
            Assert.IsNull(htVM.Items[1].HandTimeDiff);

            // Operation
            htVM.AssignStartNumber(htVM.Items[1], 2);

            // Check Post-Condition
            Assert.AreEqual(2U, htVM.Items[1].StartNumber);
            Assert.IsNull(htVM.Items[1].ATime);
            Assert.AreEqual(new TimeSpan(0, 8, 5, 2, 300), htVM.Items[1].HandTime);
            Assert.IsNull(htVM.Items[1].HandTimeDiff);
            Assert.IsNull(htVM.Items[1].StartTime);
            Assert.IsNull(htVM.Items[1].FinishTime);

            Assert.AreEqual(2, htVM.Items.Count);
        }