Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        public void TestTimeZone()
        {
            TimeZoneInfo tz = TimeZoneUtil.FindTimeZoneById("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));
        }
Ejemplo n.º 3
0
 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));
 }