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 static void MyClassInitialize(TestContext testContext) { t.StartTime = new DateTime(2012, 1, 20); t.EndTime = new DateTime(2012, 2, 5); CleanUpLogs(); engineConfig.EngineConfig = new EngineSettings(); engineConfig.EngineConfig.LogLevel = LogLevel.Info; engineConfig.EngineConfig.SleepTicks = 10000; engineConfig.EngineConfig.Enabled = true; SetupDailyRunOnce(); SetupMonthlyRunOnce(); SetupWeeklyRunOnce(); SetupYearlyRunOnce(); engineConfig.Jobs = jobsList; SamayEngine se = new SamayEngine(); se.RunEngine(t, engineConfig); }
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()); } }