当前位置: 首页>>代码示例>>C#>>正文


C# Schedule.IsOccurring方法代码示例

本文整理汇总了C#中ScheduleWidget.ScheduledEvents.Schedule.IsOccurring方法的典型用法代码示例。如果您正苦于以下问题:C# Schedule.IsOccurring方法的具体用法?C# Schedule.IsOccurring怎么用?C# Schedule.IsOccurring使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ScheduleWidget.ScheduledEvents.Schedule的用法示例。


在下文中一共展示了Schedule.IsOccurring方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: YearTest2

        public void YearTest2()
        {
            var aEvent = new Event()
            {
                ID = 1,
                Title = "Event 2",
                FrequencyTypeOptions = FrequencyTypeEnum.Yearly,
                Anniversary = new Anniversary()
                {
                    Month = 9,
                    Day = 27
                }
            };

            var schedule = new Schedule(aEvent);
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2014, 9, 27)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2015, 9, 27)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2016, 9, 27)));

            var range = new DateRange()
            {
                StartDateTime = new DateTime(2012, 1, 1),
                EndDateTime = new DateTime(2016, 12, 31)
            };

            var occurrences = schedule.Occurrences(range);

            Assert.AreEqual(5, occurrences.Count());
            Assert.AreEqual(new DateTime(2012, 9, 27), occurrences.First());
            Assert.AreEqual(new DateTime(2016, 9, 27), occurrences.Last());
        }
开发者ID:Rachitman,项目名称:ScheduleWidget,代码行数:31,代码来源:YearTests.cs

示例2: WeeklyEventOnEveryMonWedFriTest

        public void WeeklyEventOnEveryMonWedFriTest()
        {
            var aEvent = new Event()
            {
                ID = 1,
                Title = "Weekly on Monday, Wednesday, Friday",
                Frequency = 64,        // weekly on Monday, Wednesday, Friday
                DaysOfWeek = 42,      // every Mon, Wed and Fri
                StartDateTime = new DateTime(2013, 8, 2)
            };

            var schedule = new Schedule(aEvent);

            Assert.IsTrue(schedule.IsOccurring(new DateTime(2013, 8, 2)));

            Assert.IsFalse(schedule.IsOccurring(new DateTime(2013, 8, 3)));
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2013, 8, 4)));

            Assert.IsTrue(schedule.IsOccurring(new DateTime(2013, 8, 5)));

            Assert.IsFalse(schedule.IsOccurring(new DateTime(2013, 8, 6)));

            Assert.IsTrue(schedule.IsOccurring(new DateTime(2013, 8, 7)));

            Assert.IsFalse(schedule.IsOccurring(new DateTime(2013, 8, 8)));

            Assert.IsTrue(schedule.IsOccurring(new DateTime(2013, 8, 9)));

            Assert.IsFalse(schedule.IsOccurring(new DateTime(2013, 8, 10)));
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2013, 8, 11)));
        }
开发者ID:Rachitman,项目名称:ScheduleWidget,代码行数:31,代码来源:WeeklyTests.cs

示例3: RecurringScheduleIsOccurringTest1

 public void RecurringScheduleIsOccurringTest1()
 {
     var aEvent = CreateRecurringEvent();
     var schedule = new Schedule(aEvent);
     Assert.IsNotNull(schedule);
     Assert.IsTrue(schedule.IsOccurring(new DateTime(2012, 10, 1)));
     Assert.IsFalse(schedule.IsOccurring(new DateTime(2013, 1, 18)));
 }
开发者ID:willemda,项目名称:ScheduleWidget,代码行数:8,代码来源:BasicTest.cs

示例4: EventOptionsIndependenceDayTest

        public void EventOptionsIndependenceDayTest()
        {
            var holidays = GetHolidays();
            var aEvent = CreateStreetCleaningEvent();
            var schedule = new Schedule(aEvent, holidays);

            Assert.IsNotNull(holidays);
            Assert.IsNotNull(aEvent);
            Assert.IsNotNull(schedule);
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2012, 7, 4)));
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2016, 7, 4)));
        }
开发者ID:hoopkjaz,项目名称:ScheduleWidget,代码行数:12,代码来源:EventOptionsTests.cs

示例5: SimpleScheduleIsOccurringTest2

 public void SimpleScheduleIsOccurringTest2()
 {
     var aEvent = CreateTodayEvent();
     var schedule = new Schedule(aEvent);
     Assert.IsNotNull(schedule);
     Assert.IsFalse(schedule.IsOccurring(DateTime.Today.AddDays(1)));
 }
开发者ID:hoopkjaz,项目名称:ScheduleWidget,代码行数:7,代码来源:BasicTest.cs

示例6: EventOptionsLaborDayTest

        public void EventOptionsLaborDayTest()
        {
            var holidays = GetHolidays();
            var aEvent = CreateStreetCleaningEvent();
            var schedule = new Schedule(aEvent, holidays);

            Assert.IsNotNull(holidays);
            Assert.IsNotNull(aEvent);
            Assert.IsNotNull(schedule);

            // Labor Day
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2012, 9, 3)));
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2013, 9, 2)));
            // Third Monday in Sep
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2014, 9, 15)));
        }
开发者ID:hoopkjaz,项目名称:ScheduleWidget,代码行数:16,代码来源:EventOptionsTests.cs

示例7: AnniversaryTest2

        public void AnniversaryTest2()
        {
            var anniversary = new Anniversary()
            {
                Day = 5,
                Month = 6
            };

            var aEvent = new Event()
            {
                ID = 1,
                Title = "Give Flowers to Wife",
                Frequency = 16, // yearly
                Anniversary = anniversary
            };

            var schedule = new Schedule(aEvent);
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2009, 6, 4)));

            var range = new DateRange()
            {
                StartDateTime = new DateTime(2010, 1, 1),
                EndDateTime = new DateTime(2020, 12, 31)
            };

            var occurrences = schedule.Occurrences(range).ToList();
            Assert.IsTrue(occurrences.Count.Equals(11));
        }
开发者ID:hoopkjaz,项目名称:ScheduleWidget,代码行数:28,代码来源:AnniversaryTests.cs

示例8: MonthTest1

        public void MonthTest1()
        {
            var aEvent = new Event()
            {
                ID = 1,
                Title = "Event 1",
                FrequencyTypeOptions = FrequencyTypeEnum.Monthly,
                MonthlyIntervalOptions = MonthlyIntervalEnum.EveryWeek,
                DaysOfWeekOptions = DayOfWeekEnum.Mon | DayOfWeekEnum.Fri
            };

            var range = new DateRange()
            {
                StartDateTime = new DateTime(2013, 1, 15),
                EndDateTime = new DateTime(2013, 4, 30)
            };

            var occurringDate = new DateTime(2013, 1, 21);

            var schedule = new Schedule(aEvent);
            Assert.IsTrue(schedule.IsOccurring(occurringDate));

            var previousOccurrence = schedule.PreviousOccurrence(occurringDate, range);
            Assert.AreEqual(new DateTime(2013, 1, 18), previousOccurrence.Value);

            var nextOccurrence = schedule.NextOccurrence(occurringDate, range);
            Assert.AreEqual(new DateTime(2013, 1, 25), nextOccurrence.Value);

            var occurrences = schedule.Occurrences(range);

            Assert.AreEqual(30, occurrences.Count());
            Assert.AreEqual(new DateTime(2013, 1, 18), occurrences.First());
            Assert.AreEqual(new DateTime(2013, 4, 29), occurrences.Last());
        }
开发者ID:Rachitman,项目名称:ScheduleWidget,代码行数:34,代码来源:MonthTests.cs

示例9: SimpleScheduleIsOccurringTest1

 public void SimpleScheduleIsOccurringTest1()
 {
     var aEvent = CreateTodayEvent();
     var schedule = new Schedule(aEvent);
     Assert.IsNotNull(schedule);
     Assert.IsTrue(schedule.IsOccurring(DateTime.Today));
 }
开发者ID:hoopkjaz,项目名称:ScheduleWidget,代码行数:7,代码来源:BasicTest.cs

示例10: DailyEventTest1

        public void DailyEventTest1()
        {
            var aEvent = new Event()
            {
                ID = 1,
                Title = "Event 1",
                Frequency = 1,        // daily
                MonthlyInterval = 0,  // not applicable
                DaysOfWeek = 127      // every day of week
            };

            var schedule = new Schedule(aEvent);

            Assert.IsTrue(schedule.IsOccurring(new DateTime(2013, 2, 10)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2013, 4, 29)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2013, 11, 17)));
        }
开发者ID:raghav-khunger,项目名称:ScheduleWidget,代码行数:17,代码来源:DailyTests.cs

示例11: DailyEventTest3

        public void DailyEventTest3()
        {
            var aEvent = new Event()
            {
                ID = 1,
                Title = "Event 3",
                FrequencyTypeOptions = FrequencyTypeEnum.Daily,
                RepeatInterval = 4,
                StartDateTime = new DateTime(2013, 1, 3)
            };

            var schedule = new Schedule(aEvent);

            Assert.IsTrue(schedule.IsOccurring(new DateTime(2013, 1, 7)));
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2013, 1, 12)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2013, 2, 4)));
        }
开发者ID:Rachitman,项目名称:ScheduleWidget,代码行数:17,代码来源:DailyTests.cs

示例12: DailyEventTest2

        public void DailyEventTest2()
        {
            var aEvent = new Event()
            {
                ID = 1,
                Title = "Event 2",
                RangeInYear = null,
                Frequency = 1,        // daily
                MonthlyInterval = 0,  // not applicable
                DaysOfWeek = 16       // Thursday
            };

            var schedule = new Schedule(aEvent);

            Assert.IsTrue(schedule.IsOccurring(new DateTime(2013, 2, 14)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2013, 4, 25)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2013, 11, 7)));
        }
开发者ID:raghav-khunger,项目名称:ScheduleWidget,代码行数:18,代码来源:DailyTests.cs

示例13: YearTest1

        public void YearTest1()
        {
            var aEvent = new Event()
            {
                ID = 1,
                Title = "Event 1",
                FrequencyTypeOptions = FrequencyTypeEnum.Yearly,
                Anniversary = new Anniversary()
                {
                    Month = 9,
                    Day = 27
                }
            };

            var schedule = new Schedule(aEvent);
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2014, 9, 27)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2015, 9, 27)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2016, 9, 27)));
        }
开发者ID:Rachitman,项目名称:ScheduleWidget,代码行数:19,代码来源:YearTests.cs

示例14: SimpleExcludedDayTest2

        public void SimpleExcludedDayTest2()
        {
            // first Mon of Sep
            var excludedDay = new DateTime(2012, 9, 3);
            var aEvent = CreateRecurringEvent();
            var excludedDates = new List<DateTime>()
            {
                excludedDay
            };

            var schedule = new Schedule(aEvent, excludedDates);
            Assert.IsNotNull(schedule);
            Assert.IsFalse(schedule.IsOccurring(excludedDay));
        }
开发者ID:willemda,项目名称:ScheduleWidget,代码行数:14,代码来源:SimpleDateTest.cs

示例15: FineGrainedRangeInYearTest

        public void FineGrainedRangeInYearTest()
        {
            var holidays = GetHolidays();
            var aEvent = CreateFineGrainedStreetCleaningEvent();
            var schedule = new Schedule(aEvent, holidays);

            Assert.IsNotNull(holidays);
            Assert.IsNotNull(aEvent);
            Assert.IsNotNull(schedule);

            Assert.IsTrue(schedule.IsOccurring(new DateTime(2016, 6, 20)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2016, 5, 16)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2016, 6, 6)));

            Assert.IsTrue(schedule.IsOccurring(new DateTime(2018, 10, 15)));
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2018, 11, 5)));

            Assert.IsFalse(schedule.IsOccurring(new DateTime(2018, 1, 1)));
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2018, 2, 5)));
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2018, 3, 19)));

            Assert.IsFalse(schedule.IsOccurring(new DateTime(2014, 11, 1)));
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2014, 12, 1)));
        }
开发者ID:hoopkjaz,项目名称:ScheduleWidget,代码行数:24,代码来源:RangeEachYearTests.cs


注:本文中的ScheduleWidget.ScheduledEvents.Schedule.IsOccurring方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。