public void EveryWeekday() { // Arrange var sunday = new DateTime(2018, 02, 18); var saturday = new DateTime(2018, 02, 17); var monday = new DateTime(2018, 02, 19); var calculator = new TimeCalculator(); var run = new DayUnit(calculator); // Act run.Weekday(); var calculated = calculator.Calculate(sunday); // Assert var expected = new DateTime(2018, 02, 19); Assert.AreEqual(expected, calculated); // Act calculated = calculator.Calculate(saturday); // Assert Assert.AreEqual(expected, calculated); // Act calculated = calculator.Calculate(monday); // Assert Assert.AreEqual(expected, calculated); }
/// <summary> /// Delays the job for the given interval. /// </summary> /// <param name="unit">The schedule being affected.</param> /// <param name="interval">Interval to wait.</param> public static DelayTimeUnit DelayFor(this DayUnit unit, int interval) { if (unit == null) { throw new ArgumentNullException("unit"); } return(DelayFor(unit.Schedule, interval)); }
/// <summary> /// Delay first execution of the task for the specified time interval. /// </summary> public static DelayTimeUnit DelayFor(this DayUnit timeUnit, int interval) { return(DelayFor(timeUnit.Schedule, interval)); }