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 |
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)); }
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)); }
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)); }
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)); }