當前位置: 首頁>>代碼示例>>C#>>正文


C# Schedule.GetLastOccurrenceDate方法代碼示例

本文整理匯總了C#中ScheduleWidget.ScheduledEvents.Schedule.GetLastOccurrenceDate方法的典型用法代碼示例。如果您正苦於以下問題:C# Schedule.GetLastOccurrenceDate方法的具體用法?C# Schedule.GetLastOccurrenceDate怎麽用?C# Schedule.GetLastOccurrenceDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ScheduleWidget.ScheduledEvents.Schedule的用法示例。


在下文中一共展示了Schedule.GetLastOccurrenceDate方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LastOccurrenceTest1

        public void LastOccurrenceTest1()
        {
            var aEvent = new Event()
            {
                ID = 1,
                Title = "Daily, 3 times",
                FrequencyTypeOptions = FrequencyTypeEnum.Daily,
                NumberOfOccurrences = 3,
                FirstDateTime = new DateTime(2013, 7, 29)
            };

            var schedule = new Schedule(aEvent);
            DateTime? endDate = schedule.GetLastOccurrenceDate();
            Assert.IsTrue(endDate == new DateTime(2013, 7, 31));
        }
開發者ID:hoopkjaz,項目名稱:ScheduleWidget,代碼行數:15,代碼來源:LastOccurrenceTests.cs

示例2: LastOccurrenceTest3

        public void LastOccurrenceTest3()
        {
            var aEvent = new Event()
            {
                ID = 3,
                Title = "Weekly on Monday, Tuesday, 3 times",
                FrequencyTypeOptions = FrequencyTypeEnum.Weekly,
                DaysOfWeek = 6,
                NumberOfOccurrences = 3,
                FirstDateTime = new DateTime(2013, 7, 29)
            };

            var schedule = new Schedule(aEvent);
            DateTime? endDate = schedule.GetLastOccurrenceDate();
            Assert.IsTrue(endDate == new DateTime(2013, 8, 5));
        }
開發者ID:hoopkjaz,項目名稱:ScheduleWidget,代碼行數:16,代碼來源:LastOccurrenceTests.cs

示例3: LastOccurrenceTest2

        public void LastOccurrenceTest2()
        {
            var aEvent = new Event()
            {
                ID = 2,
                Title = "Every 2 days, 3 times",
                FrequencyTypeOptions = FrequencyTypeEnum.Daily,
                NumberOfOccurrences = 3,
                DayInterval = 2,
                FirstDateTime = new DateTime(2013, 7, 29)
            };

            var schedule = new Schedule(aEvent);
            DateTime? endDate = schedule.GetLastOccurrenceDate();
            Assert.IsTrue(endDate == new DateTime(2013, 8, 2));
        }
開發者ID:hoopkjaz,項目名稱:ScheduleWidget,代碼行數:16,代碼來源:LastOccurrenceTests.cs

示例4: LastOccurrenceTest10

        public void LastOccurrenceTest10()
        {
            var aEvent = new Event()
            {
                ID = 10,
                Title = "Annually on July 29, 2 times",
                FrequencyTypeOptions = FrequencyTypeEnum.Yearly,
                Anniversary = new Anniversary { Day = 29, Month = 7 },
                StartDateTime = new DateTime(2013, 7, 29)
            };
            aEvent.SetEndDateWithNumberOfOccurrences(2);

            var schedule = new Schedule(aEvent);
            DateTime? endDate = schedule.GetLastOccurrenceDate();
            Assert.IsTrue(endDate == new DateTime(2014, 7, 29));
        }
開發者ID:Rachitman,項目名稱:ScheduleWidget,代碼行數:16,代碼來源:LastOccurrenceTests.cs

示例5: LastOccurrenceTest4

        public void LastOccurrenceTest4()
        {
            var aEvent = new Event()
            {
                ID = 4,
                Title = "Every 2 weeks on Monday, Tuesday, Wednesday, 10 times",
                FrequencyTypeOptions = FrequencyTypeEnum.Weekly,
                DaysOfWeek = 14,
                WeeklyInterval = 2,
                NumberOfOccurrences = 10,
                FirstDateTime = new DateTime(2013, 7, 29)
            };

            var schedule = new Schedule(aEvent);
            DateTime? endDate = schedule.GetLastOccurrenceDate();
            Assert.IsTrue(endDate == new DateTime(2013, 9, 9));
        }
開發者ID:hoopkjaz,項目名稱:ScheduleWidget,代碼行數:17,代碼來源:LastOccurrenceTests.cs

示例6: LastOccurrenceTest5

        public void LastOccurrenceTest5()
        {
            var aEvent = new Event()
            {
                ID = 5,
                Title = "Monthly on day 29, 3 times",
                FrequencyTypeOptions = FrequencyTypeEnum.Monthly,
                DayOfMonth = 29,
                NumberOfOccurrences = 3,
                FirstDateTime = new DateTime(2013, 7, 29)
            };

            var schedule = new Schedule(aEvent);
            DateTime? endDate = schedule.GetLastOccurrenceDate();
            Assert.IsTrue(endDate == new DateTime(2013, 9, 29));
        }
開發者ID:hoopkjaz,項目名稱:ScheduleWidget,代碼行數:16,代碼來源:LastOccurrenceTests.cs

示例7: LastOccurrenceTest11

        public void LastOccurrenceTest11()
        {
            var aEvent = new Event()
            {
                ID = 10,
                Title = "Every 2 years on July 29, 2 times",
                FrequencyTypeOptions = FrequencyTypeEnum.Yearly,
                NumberOfOccurrences = 2,
                YearInterval = 2,
                Anniversary = new Anniversary { Day = 29, Month = 7 },
                FirstDateTime = new DateTime(2013, 7, 29)
            };

            var schedule = new Schedule(aEvent);
            DateTime? endDate = schedule.GetLastOccurrenceDate();
            Assert.IsTrue(endDate == new DateTime(2015, 7, 29));
        }
開發者ID:hoopkjaz,項目名稱:ScheduleWidget,代碼行數:17,代碼來源:LastOccurrenceTests.cs

示例8: LastOccurrenceTest9

        public void LastOccurrenceTest9()
        {
            var aEvent = new Event()
            {
                ID = 9,
                Title = "Every 2 months on the last Monday, 3 times",
                FrequencyTypeOptions = FrequencyTypeEnum.Monthly,
                DaysOfWeek = 2,
                NumberOfOccurrences = 3,
                MonthInterval = 2,
                MonthlyIntervalOptions = MonthlyIntervalEnum.Last,
                FirstDateTime = new DateTime(2013, 7, 29)
            };

            var schedule = new Schedule(aEvent);
            DateTime? endDate = schedule.GetLastOccurrenceDate();
            Assert.IsTrue(endDate == new DateTime(2013, 11, 25));
        }
開發者ID:hoopkjaz,項目名稱:ScheduleWidget,代碼行數:18,代碼來源:LastOccurrenceTests.cs

示例9: LastOccurrenceTest7

        public void LastOccurrenceTest7()
        {
            var aEvent = new Event()
            {
                ID = 7,
                Title = "Monthly on the last Monday, 3 times",
                FrequencyTypeOptions = FrequencyTypeEnum.Monthly,
                DaysOfWeek = 2,
                MonthlyIntervalOptions = MonthlyIntervalEnum.Last,
                StartDateTime = new DateTime(2013, 7, 29)
            };
            aEvent.SetEndDateWithNumberOfOccurrences(3);

            var schedule = new Schedule(aEvent);
            DateTime? endDate = schedule.GetLastOccurrenceDate();
            Assert.IsTrue(endDate == new DateTime(2013, 9, 30));
        }
開發者ID:Rachitman,項目名稱:ScheduleWidget,代碼行數:17,代碼來源:LastOccurrenceTests.cs

示例10: LastOccurrenceTest6

        public void LastOccurrenceTest6()
        {
            var aEvent = new Event()
            {
                ID = 6,
                Title = "Every 2 months on day 29, 3 times",
                FrequencyTypeOptions = FrequencyTypeEnum.Monthly,
                DayOfMonth = 29,
                RepeatInterval = 2,
                StartDateTime = new DateTime(2013, 7, 29)
            };
            aEvent.SetEndDateWithNumberOfOccurrences(3);

            var schedule = new Schedule(aEvent);
            DateTime? endDate = schedule.GetLastOccurrenceDate();
            Assert.IsTrue(endDate == new DateTime(2013, 11, 29));
        }
開發者ID:Rachitman,項目名稱:ScheduleWidget,代碼行數:17,代碼來源:LastOccurrenceTests.cs

示例11: MultifunctionTest1

        public void MultifunctionTest1()
        {
            var aEvent = new Event()
            {
                FrequencyTypeOptions = FrequencyTypeEnum.Yearly,
                RepeatInterval = 2,
                StartDateTime = new DateTime(2000, 9, 27), // even years only
                Anniversary = new Anniversary()
                {
                    Month = 9,
                    Day = 27
                }
            };
            // Occurs 2000,2002,2004,2006,2008,2010
            aEvent.SetEndDateWithNumberOfOccurrences(6);

            // Check that the ending date was set correctly.
            Assert.IsTrue(aEvent.EndDateTime == new DateTime(2010, 9, 27));

            // Check that the number of occurrences is retrievable.
            Assert.IsTrue(aEvent.NumberOfOccurrencesThatWasLastSet == 6);

            // Exclude 2000,2006,2010.
            var excludedDates = new List<DateTime>
            {
                new DateTime(2000, 9, 27),
                new DateTime(2005, 9, 27),
                new DateTime(2005, 9, 28),
                new DateTime(2006, 9, 27),
                new DateTime(2010, 9, 27)
            };
            var schedule = new Schedule(aEvent, excludedDates);

            // Make sure it is not occurring on excluded dates.
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2000, 9, 27)));
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2006, 9, 27)));
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2010, 9, 27)));

            // Make sure it is not occurring outside the set range.
            Assert.IsFalse(schedule.IsOccurring(new DateTime(1998, 9, 27)));
            Assert.IsFalse(schedule.IsOccurring(new DateTime(2012, 9, 27)));

            // Make sure it is occurring on desired dates.
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2002, 9, 27)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2004, 9, 27)));
            Assert.IsTrue(schedule.IsOccurring(new DateTime(2008, 9, 27)));

            // Check the occurrences function.
            var during = new DateRange(new DateTime(1995, 1, 1),new DateTime(2015, 1, 1));
            var occurrences = schedule.Occurrences(during);
            Assert.IsTrue(occurrences.Count() == 3);

            // Check the last occurrence date function.
            var lastDate = schedule.GetLastOccurrenceDate();
            Assert.IsTrue(lastDate == new DateTime(2008, 9, 27));

            // Check the next occurrence (date only) function.
            Assert.IsTrue(schedule.NextOccurrence(new DateTime(1995, 1, 1)) == new DateTime(2002, 9, 27));
            Assert.IsTrue(schedule.NextOccurrence(new DateTime(2004, 9, 26)) == new DateTime(2004, 9, 27));
            Assert.IsTrue(schedule.NextOccurrence(new DateTime(2004, 9, 27)) == new DateTime(2008, 9, 27));
            Assert.IsTrue(schedule.NextOccurrence(new DateTime(2008, 9, 27)) == null);

            // Check the previous occurrence (date only) function.
            Assert.IsTrue(schedule.PreviousOccurrence(new DateTime(1995, 1, 1)) == null);
            Assert.IsTrue(schedule.PreviousOccurrence(new DateTime(2004, 9, 26)) == new DateTime(2002, 9, 27));
            Assert.IsTrue(schedule.PreviousOccurrence(new DateTime(2004, 9, 28)) == new DateTime(2004, 9, 27));
            Assert.IsTrue(schedule.PreviousOccurrence(new DateTime(2013, 9, 27)) == new DateTime(2008, 9, 27));

            // Check the next occurrence ranged function.
            var range1 = new DateRange(new DateTime(2004, 9, 1), new DateTime(2004, 10, 1));
            var range2 = new DateRange(new DateTime(2004, 11, 1), new DateTime(2002, 9, 27));
            Assert.IsTrue(schedule.NextOccurrence(new DateTime(1995, 1, 1), range1) == new DateTime(2004, 9, 27));
            Assert.IsTrue(schedule.NextOccurrence(new DateTime(1995, 1, 1), range2) == null);

            // Check the previous occurrence ranged function.
            Assert.IsTrue(schedule.PreviousOccurrence(new DateTime(2015, 1, 1), range1) == new DateTime(2004, 9, 27));
            Assert.IsTrue(schedule.PreviousOccurrence(new DateTime(2015, 1, 1), range2) == null);
        }
開發者ID:Rachitman,項目名稱:ScheduleWidget,代碼行數:78,代碼來源:AAMultifunctionTests.cs


注:本文中的ScheduleWidget.ScheduledEvents.Schedule.GetLastOccurrenceDate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。