/// <summary> /// Creates a new object that is a copy of the current instance. /// </summary> /// <returns>A new object that is a copy of this instance.</returns> public override object Clone() { MonthlyCalendar clone = (MonthlyCalendar)base.Clone(); bool[] excludeCopy = new bool[excludeDays.Length]; Array.Copy(excludeDays, excludeCopy, excludeDays.Length); clone.excludeDays = excludeCopy; return(clone); }
/// <summary> /// Creates a new object that is a copy of the current instance. /// </summary> /// <returns>A new object that is a copy of this instance.</returns> public override ICalendar Clone() { MonthlyCalendar clone = new MonthlyCalendar(); CloneFields(clone); bool[] excludeCopy = new bool[excludeDays.Length]; Array.Copy(excludeDays, excludeCopy, excludeDays.Length); clone.excludeDays = excludeCopy; return(clone); }
public void TestForInfiniteLoop() { MonthlyCalendar monthlyCalendar = new MonthlyCalendar(); for (int i = 1; i < 9; i++) { monthlyCalendar.SetDayExcluded(i, true); } DateTime d = new DateTime(2007, 11, 8, 12, 0, 0); monthlyCalendar.GetNextIncludedTimeUtc(d.ToUniversalTime()); }
public void TestTimeZone() { TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); MonthlyCalendar monthlyCalendar = new MonthlyCalendar(); monthlyCalendar.TimeZone = tz; monthlyCalendar.SetDayExcluded(4, true); // 11/5/2012 12:00:00 AM -04:00 translate into 11/4/2012 11:00:00 PM -05:00 (EST) DateTimeOffset date = new DateTimeOffset(2012, 11, 5, 0, 0, 0, TimeSpan.FromHours(-4)); Assert.IsFalse(monthlyCalendar.IsTimeIncluded(date)); }
public bool Equals(MonthlyCalendar obj) { //a little trick here : Monthly calendar knows nothing //about the precise month it is dealing with, so //FebruaryCalendars will be only equal if their //31st days are equally included //but that's not going to be a problem since //there's no need to redefine default value of false //for such days if (obj == null) { return(false); } bool baseEqual = GetBaseCalendar() == null || GetBaseCalendar().Equals(obj.GetBaseCalendar()); return(baseEqual && DaysExcluded.SequenceEqual(obj.DaysExcluded)); }
public bool Equals(MonthlyCalendar obj) { //a little trick here : Monthly calendar knows nothing //about the precise month it is dealing with, so //FebruaryCalendars will be only equal if their // 31st days are equally included )) //but that's not going to be a problem since //there's no need to redefine default value of false //for such days if (obj == null) { return(false); } var baseEqual = GetBaseCalendar() != null? GetBaseCalendar().Equals(obj.GetBaseCalendar()) : true; return(baseEqual && (ArraysEqualElementsOnEqualPlaces(DaysExcluded, obj.DaysExcluded) )); }
public void Setup() { cal = new MonthlyCalendar(); }
static void InitializeMonthly(MonthlyCalendar monthlyCalendar, IMonthlyCalendar calendar) { monthlyCalendar.TimeZone = TimeZoneInfo.FindSystemTimeZoneById(Persistent.Base.General.RegistryTimeZoneProvider.GetRegistryKeyNameByTimeZoneId(calendar.TimeZone)); calendar.DaysExcluded.ForEach(i => monthlyCalendar.SetDayExcluded(i, true)); calendar.DaysIncluded.ForEach(i => monthlyCalendar.SetDayExcluded(i, false)); }
public bool Equals(MonthlyCalendar obj) { //a little trick here : Monthly calendar knows nothing //about the precise month it is dealing with, so //FebruaryCalendars will be only equal if their // 31st days are equally included )) //but that's not going to be a problem since //there's no need to redefine default value of false //for such days if (obj == null) { return false; } bool baseEqual = GetBaseCalendar() == null || GetBaseCalendar().Equals(obj.GetBaseCalendar()); return baseEqual && (ArraysEqualElementsOnEqualPlaces(DaysExcluded, obj.DaysExcluded) ); }
public void TestRemoveCalendarWhenTriggersPresent() { // QRTZNET-29 IOperableTrigger trigger = new SimpleTriggerImpl("trigger1", "triggerGroup1", fJobDetail.Name, fJobDetail.Group, DateTimeOffset.Now.AddSeconds(100), DateTimeOffset.Now.AddSeconds(200), 2, TimeSpan.FromSeconds(2)); trigger.ComputeFirstFireTimeUtc(null); ICalendar cal = new MonthlyCalendar(); fJobStore.StoreTrigger(trigger, false); fJobStore.StoreCalendar("cal", cal, false, true); fJobStore.RemoveCalendar("cal"); }
public MonthlyCalendarDto(MonthlyCalendar calendar) : base(calendar) { DaysExcluded = calendar.DaysExcluded.ToList(); TimeZone = new TimeZoneDto(calendar.TimeZone); }