public void DailyOvernightTest() { DateTime NOW = startTestTime; bool expected, lastexpected = true; try { while (NOW <= endTestTime) { NOW = NOW.AddMinutes(1); //NOW = DateTime.Parse("1/1/2011 3:59:00 AM"); if (SamayEngine.IsBetWeen(Midnightime, GetOvernightTime().EndTime, new DateTime(NOW.TimeOfDay.Ticks)) || (SamayEngine.IsBetWeen(GetOvernightTime().StartTime, Midnightime.AddDays(1), new DateTime(NOW.TimeOfDay.Ticks)))) { expected = true; } else { expected = false; } Log(NOW, expected, ref lastexpected); bool actual = SamayEngine.IsJobScheduledToRunNow(dailyOvernightSchedule, NOW); Assert.AreEqual(expected, actual); } } catch { throw new Exception("Failed for Time: " + NOW.ToString()); } }
private static void RunTests(JobSchedule schedule, System.Collections.Generic.Dictionary <DateTime, DateTime> validRanges) { DateTime NOW = startTestTime; bool expected, lastexpected = true; try { while (NOW <= endTestTime) { expected = false; NOW = NOW.AddMinutes(1); //NOW = DateTime.Parse("2/5/2011 9:00:00 PM"); foreach (var item in validRanges.Keys) { if (SamayEngine.IsBetWeen(item, validRanges[item], NOW)) { expected = true; break; } } bool actual = SamayEngine.IsJobScheduledToRunNow(schedule, NOW); Log(NOW, expected, ref lastexpected); Assert.AreEqual(expected, actual); } } catch { throw new Exception("Failed for Time: " + NOW.ToString()); } }
public void DailyDayTest() { DateTime NOW = startTestTime; bool lastexpected = true; try { while (NOW <= endTestTime) { NOW = NOW.AddMinutes(1); bool expected = (NOW.TimeOfDay >= GetDayTime().StartTime.TimeOfDay) && (NOW.TimeOfDay <= GetDayTime().EndTime.TimeOfDay); bool actual = SamayEngine.IsJobScheduledToRunNow(dailyDaySchedule, NOW); Log(NOW, expected, ref lastexpected); Assert.AreEqual(expected, actual); } } catch { throw new Exception("Failed for Time: " + NOW.ToString()); } }