public void TestAnnualCalendarSerialization() { AnnualCalendar annualCalendar = new AnnualCalendar(); DateTime day = new DateTime(2011, 12, 20, 0, 0, 0); annualCalendar.SetDayExcluded(day, true); AnnualCalendar clone = annualCalendar.DeepClone(); Assert.IsTrue(clone.IsDayExcluded(day)); }
public void TestDaysExcludedOverTime() { AnnualCalendar annualCalendar = new AnnualCalendar(); DateTime day = new DateTime(2005, 6, 23); annualCalendar.SetDayExcluded(day, true); day = new DateTime(2008, 2, 1); annualCalendar.SetDayExcluded(day, true); Assert.IsTrue(annualCalendar.IsDayExcluded(day), "The day 1 February is expected to be excluded but it is not"); }
public void TestRemoveInTheFuture() { AnnualCalendar annualCalendar = new AnnualCalendar(); DateTime day = new DateTime(2005, 6, 23); annualCalendar.SetDayExcluded(day, true); // Trying to remove the 23th of June day = new DateTime(2008, 6, 23); annualCalendar.SetDayExcluded(day, false); Assert.IsFalse(annualCalendar.IsDayExcluded(day), "The day 23 June is not expected to be excluded but it is"); }
public void BaseCalendarShouldNotAffectSettingInternalDataStructures() { var dayToExclude = new DateTime(2015, 1, 1); AnnualCalendar a = new AnnualCalendar(); a.SetDayExcluded(dayToExclude, true); AnnualCalendar b = new AnnualCalendar(a); b.SetDayExcluded(dayToExclude, true); b.CalendarBase = null; Assert.That(b.IsDayExcluded(dayToExclude), "day was no longer excluded after base calendar was detached"); }
public void TestDayExclusion() { // we're local by default DateTime d = new DateTime(2005, 1, 1); cal.SetDayExcluded(d, true); Assert.IsFalse(cal.IsTimeIncluded(d.ToUniversalTime()), "Time was included when it was supposed not to be"); Assert.IsTrue(cal.IsDayExcluded(d), "Day was not excluded when it was supposed to be excluded"); Assert.AreEqual(1, cal.DaysExcluded.Count); Assert.AreEqual(d.Day, cal.DaysExcluded.First().Day); Assert.AreEqual(d.Month, cal.DaysExcluded.First().Month); }