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


C# DailyTimeIntervalTriggerImpl.GetFireTimeAfter方法代碼示例

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


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

示例1: TestGetFireTimeWhenStartTimeAndTimeOfDayIsSame

        public void TestGetFireTimeWhenStartTimeAndTimeOfDayIsSame()
        {
            // A test case for QTZ-369
            DateTime startTime = new DateTime(2012, 1, 1);
            TimeOfDay startTimeOfDay = new TimeOfDay(8, 0, 0);
            TimeOfDay endTimeOfDay = new TimeOfDay(13, 0, 0);
            var trigger = new DailyTimeIntervalTriggerImpl();
            trigger.StartTimeUtc = startTime;
            trigger.StartTimeOfDay = startTimeOfDay;
            trigger.EndTimeOfDay = endTimeOfDay;
            trigger.RepeatIntervalUnit = IntervalUnit.Hour;
            trigger.RepeatInterval = 1;

            Assert.AreEqual(dateOf(8, 0, 0, 1, 1, 2012), trigger.GetFireTimeAfter(new DateTime(2012, 1, 1)));
        }
開發者ID:CharlieBP,項目名稱:quartznet,代碼行數:15,代碼來源:DailyTimeIntervalTriggerImplTest.cs

示例2: TestGetFireTime

        public void TestGetFireTime()
        {
            DateTime startTime = new DateTime(2011, 1, 1);
            TimeOfDay startTimeOfDay = new TimeOfDay(8, 0, 0);
            TimeOfDay endTimeOfDay = new TimeOfDay(13, 0, 0);
            var trigger = new DailyTimeIntervalTriggerImpl();
            trigger.StartTimeUtc = startTime;
            trigger.StartTimeOfDay = startTimeOfDay;
            trigger.EndTimeOfDay = endTimeOfDay;
            trigger.RepeatIntervalUnit = IntervalUnit.Hour;
            trigger.RepeatInterval = 1;

            Assert.AreEqual(dateOf(8, 0, 0, 1, 1, 2011), trigger.GetFireTimeAfter(dateOf(0, 0, 0, 1, 1, 2011)));
            Assert.AreEqual(dateOf(8, 0, 0, 1, 1, 2011), trigger.GetFireTimeAfter(dateOf(7, 0, 0, 1, 1, 2011)));
            Assert.AreEqual(dateOf(8, 0, 0, 1, 1, 2011), trigger.GetFireTimeAfter(dateOf(7, 59, 59, 1, 1, 2011)));
            Assert.AreEqual(dateOf(9, 0, 0, 1, 1, 2011), trigger.GetFireTimeAfter(dateOf(8, 0, 0, 1, 1, 2011)));
            Assert.AreEqual(dateOf(10, 0, 0, 1, 1, 2011), trigger.GetFireTimeAfter(dateOf(9, 0, 0, 1, 1, 2011)));
            Assert.AreEqual(dateOf(13, 0, 0, 1, 1, 2011), trigger.GetFireTimeAfter(dateOf(12, 59, 59, 1, 1, 2011)));
            Assert.AreEqual(dateOf(8, 0, 0, 2, 1, 2011), trigger.GetFireTimeAfter(dateOf(13, 0, 0, 1, 1, 2011)));
        }
開發者ID:CharlieBP,項目名稱:quartznet,代碼行數:20,代碼來源:DailyTimeIntervalTriggerImplTest.cs

示例3: TestGetFireTimeWithDateBeforeStartTime

        public void TestGetFireTimeWithDateBeforeStartTime()
        {
            DateTime startTime = new DateTime(2012, 1, 1);
            TimeOfDay startTimeOfDay = new TimeOfDay(8, 0, 0);
            TimeOfDay endTimeOfDay = new TimeOfDay(13, 0, 0);
            DailyTimeIntervalTriggerImpl trigger = new DailyTimeIntervalTriggerImpl();
            trigger.StartTimeUtc = startTime;
            trigger.StartTimeOfDay = startTimeOfDay;
            trigger.EndTimeOfDay = endTimeOfDay;
            trigger.RepeatIntervalUnit = IntervalUnit.Hour;
            trigger.RepeatInterval = 1;

            // NOTE that if you pass a date past the startTime, you will get the startTime back!
            Assert.AreEqual(dateOf(8, 0, 0, 1, 1, 2012), trigger.GetFireTimeAfter(dateOf(0, 0, 0, 1, 1, 2011)));
            Assert.AreEqual(dateOf(8, 0, 0, 1, 1, 2012), trigger.GetFireTimeAfter(dateOf(7, 0, 0, 1, 1, 2011)));
            Assert.AreEqual(dateOf(8, 0, 0, 1, 1, 2012), trigger.GetFireTimeAfter(dateOf(7, 59, 59, 1, 1, 2011)));
            Assert.AreEqual(dateOf(8, 0, 0, 1, 1, 2012), trigger.GetFireTimeAfter(dateOf(8, 0, 0, 1, 1, 2011)));
            Assert.AreEqual(dateOf(8, 0, 0, 1, 1, 2012), trigger.GetFireTimeAfter(dateOf(9, 0, 0, 1, 1, 2011)));
            Assert.AreEqual(dateOf(8, 0, 0, 1, 1, 2012), trigger.GetFireTimeAfter(dateOf(12, 59, 59, 1, 1, 2011)));
            Assert.AreEqual(dateOf(8, 0, 0, 1, 1, 2012), trigger.GetFireTimeAfter(dateOf(13, 0, 0, 1, 1, 2011)));

            // Now try some test times at or after startTime
            Assert.AreEqual(dateOf(8, 0, 0, 1, 1, 2012), trigger.GetFireTimeAfter(dateOf(0, 0, 0, 1, 1, 2012)));
            Assert.AreEqual(dateOf(8, 0, 0, 2, 1, 2012), trigger.GetFireTimeAfter(dateOf(13, 0, 0, 1, 1, 2012)));
        }
開發者ID:CharlieBP,項目名稱:quartznet,代碼行數:25,代碼來源:DailyTimeIntervalTriggerImplTest.cs

示例4: TestStartTimeBeforeStartTimeOfDayOnInvalidDay

        public void TestStartTimeBeforeStartTimeOfDayOnInvalidDay()
        {
            DateTimeOffset startTime = dateOf(0, 0, 0, 1, 1, 2011); // Jan 1, 2011 was a saturday...
            TimeOfDay startTimeOfDay = new TimeOfDay(8, 0, 0);
            var trigger = new DailyTimeIntervalTriggerImpl();
            var daysOfWeek = new Collection.HashSet<DayOfWeek>
            {
                DayOfWeek.Monday,
                DayOfWeek.Tuesday,
                DayOfWeek.Wednesday,
                DayOfWeek.Thursday,
                DayOfWeek.Friday
            };
            trigger.DaysOfWeek = daysOfWeek;
            trigger.StartTimeUtc = startTime.ToUniversalTime();
            trigger.StartTimeOfDay = startTimeOfDay;
            trigger.RepeatIntervalUnit = IntervalUnit.Minute;
            trigger.RepeatInterval = 60;

            Assert.That(trigger.GetFireTimeAfter(dateOf(6, 0, 0, 22, 5, 2010)), Is.EqualTo(dateOf(8, 0, 0, 3, 1, 2011)));

            var fireTimes = TriggerUtils.ComputeFireTimes(trigger, null, 48);
            Assert.That(fireTimes.Count, Is.EqualTo(48));
            Assert.That(fireTimes[0], Is.EqualTo(dateOf(8, 0, 0, 3, 1, 2011)));
            Assert.That(fireTimes[47], Is.EqualTo(dateOf(23, 0, 0, 5, 1, 2011)));
        }
開發者ID:CharlieBP,項目名稱:quartznet,代碼行數:26,代碼來源:DailyTimeIntervalTriggerImplTest.cs


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