public void DayOfWeekPropertyShouldNotAffectOtherTriggers() { DailyTimeIntervalScheduleBuilder builder = DailyTimeIntervalScheduleBuilder.Create(); DailyTimeIntervalTriggerImpl trigger1 = (DailyTimeIntervalTriggerImpl)builder .WithInterval(1, IntervalUnit.Hour) .OnMondayThroughFriday() .Build(); //make an adjustment to this one trigger. //I only want mondays now trigger1.DaysOfWeek.Clear(); trigger1.DaysOfWeek.Add(DayOfWeek.Monday); //build same way as trigger1 DailyTimeIntervalTriggerImpl trigger2 = (DailyTimeIntervalTriggerImpl)builder .WithInterval(1, IntervalUnit.Hour) .OnMondayThroughFriday() .Build(); //check trigger 2 DOW //this fails because the reference collection only contains MONDAY b/c it was cleared. Assert.IsTrue(trigger2.DaysOfWeek.Contains(DayOfWeek.Monday)); Assert.IsTrue(trigger2.DaysOfWeek.Contains(DayOfWeek.Tuesday)); Assert.IsTrue(trigger2.DaysOfWeek.Contains(DayOfWeek.Wednesday)); Assert.IsTrue(trigger2.DaysOfWeek.Contains(DayOfWeek.Thursday)); Assert.IsTrue(trigger2.DaysOfWeek.Contains(DayOfWeek.Friday)); Assert.IsFalse(trigger2.DaysOfWeek.Contains(DayOfWeek.Saturday)); Assert.IsFalse(trigger2.DaysOfWeek.Contains(DayOfWeek.Sunday)); }
private void ConfigureScheduleBuilder(DailyTimeIntervalScheduleBuilder ScheduleBuilder) { //ScheduleBuilder = ScheduleBuilder.InTimeZone(TimeZoneInfo.Utc); //ScheduleBuilder = ScheduleBuilder.StartingDailyAt(new TimeOfDay(0, 0, 5)); //ScheduleBuilder = ScheduleBuilder.WithInterval(1, IntervalUnit.Month); DateTimeOffset Df = DateTimeOffset.Now.AddSeconds(5.0); ScheduleBuilder = ScheduleBuilder.InTimeZone(TimeZoneInfo.Local); ScheduleBuilder = ScheduleBuilder.StartingDailyAt(new TimeOfDay(Df.Hour, Df.Minute, Df.Second)); ScheduleBuilder = ScheduleBuilder.WithInterval(20, IntervalUnit.Second); }