Пример #1
0
 public void TestTriggerCollectionSelect()
 {
     var a = new TimeTrigger { StartBoundary = DateTime.Parse("12/7/2014 6:00 PM") };
     a.Repetition.Interval = new TimeSpan(1, 0, 0);
     a.Repetition.Duration = new TimeSpan(3, 0, 0);
     var b = new TimeTrigger { StartBoundary = DateTime.Parse("12/7/2014 6:00 PM") };
     b.Repetition.Interval = new TimeSpan(0, 1, 0);
     b.Repetition.Duration = new TimeSpan(3, 0, 0);
     var span1 = new[] { a, b };
     var r = span1.SelectDates(x => x).Take(6).ToArray();
     Debug.Assert(r.Length == 6);
     //Debug.Assert(r[0].Date.Month == 2);
     //Debug.Assert(r[0].TimeOfDay == new TimeSpan(18, 0, 0));
     //Debug.Assert(r[1].Date == r[0].Date);
     //Debug.Assert(r[1].TimeOfDay == new TimeSpan(19, 0, 0));
     //Debug.Assert(r[2].Date == r[1].Date);
     //Debug.Assert(r[2].TimeOfDay == new TimeSpan(20, 0, 0));
     //Debug.Assert(r[3].Date == r[2].Date.AddYears(1));
     //Debug.Assert(r[3].TimeOfDay == new TimeSpan(18, 0, 0));
     //Debug.Assert(r[4].Date == r[3].Date);
     //Debug.Assert(r[4].TimeOfDay == new TimeSpan(19, 0, 0));
     //Debug.Assert(r[5].Date == r[4].Date);
     //Debug.Assert(r[5].TimeOfDay == new TimeSpan(20, 0, 0));
 }