private void btnCalcDissolve_Click(object sender, RoutedEventArgs e) { if (dgHandTiming.SelectedItem is HandTimingVMEntry selEntry) { _currentHandTimingVM.Dissolve(selEntry); } }
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); }