IsTimeMatch() публичный Метод

Determines if the current rule should be applied depending on the time pattern that has been applied to it.
public IsTimeMatch ( DateTimeOffset now, string timezone ) : bool
now DateTimeOffset
timezone string The timezone to adjust for. This will typically be the timezone set by the user that owns /// the dialplan. If no timezone is specified UTC will be assumed.
Результат bool
Пример #1
0
        public void TimePatternAllDaysExceptWednesdayDayTest()
        {
            SimpleWizardRule target = new SimpleWizardRule()
            {
                TimePattern = "MTuThFSaSu;00:00-23:59"
            };

            // Wednesday.
            var now = new DateTimeOffset(2011, 11, 23, 14, 28, 0, 0, TimeSpan.Zero);

            Assert.IsFalse(target.IsTimeMatch(now, null));
        }
Пример #2
0
        public void TimePatternExcludeByEndTimeTest()
        {
            SimpleWizardRule target = new SimpleWizardRule()
            {
                TimePattern = "MTuWThFSaSu;08:00-17:00"
            };

            var now = new DateTimeOffset(2011, 11, 23, 18, 28, 0, 0, TimeSpan.Zero);

            Assert.IsFalse(target.IsTimeMatch(now, null));
        }
Пример #3
0
        public void TimePatternAllDaysIncludedDayTest()
        {
            SimpleWizardRule target = new SimpleWizardRule()
            {
                TimePattern = "MTuWThFSaSu;00:00-23:59"
            };

            // Sunday.
            var now = new DateTimeOffset(2011, 11, 27, 14, 28, 0, 0, TimeSpan.Zero);

            Assert.IsTrue(target.IsTimeMatch(now, null));
        }
Пример #4
0
        public void TimePatternExcludedDayTest()
        {
            SimpleWizardRule target = new SimpleWizardRule()
            {
                TimePattern = "Tu"
            };

            // Sunday.
            var now = new DateTimeOffset(2011, 11, 27, 14, 28, 0, 0, TimeSpan.Zero);

            Assert.IsFalse(target.IsTimeMatch(now, null));
        }