private static Calendar SetupFullCalendar() { var rules = new CalendarRules { { DayRulePolicy.Fallthrough, DayRuleParser.Parse("* * * * [[working day]] 08:30-17:30") }, { DayRulePolicy.Fallthrough, DayRuleParser.Parse("* * * 6..7 [[non working day]]") } }; return(new Calendar("Five Working Days Calendar", rules, "calendar description", "this is a very long description")); }
public void TestRules(string dayRuleDefinition, DateTime[] matchingDates, DateTime[] unmatchingDates) { var dayRule = DayRuleParser.Parse(dayRuleDefinition); foreach (var @case in matchingDates) { Assert.IsTrue(dayRule.TryGetDayInfo(@case.Date, out var dayInfo)); Assert.IsNotNull(dayInfo); } foreach (var @case in unmatchingDates) { Assert.IsFalse(dayRule.TryGetDayInfo(@case.Date, out var dayInfo)); Assert.IsNull(dayInfo); } }