示例#1
0
        public void TestChainDetecting(
            [Values(
                 "Monday - Friday",
                 "Monday, Tuesday",
                 "Monday - Wednesday",
                 "Sun, Mon, Tue, Wed, Fri, Sat",
                 "Sun, Mon, Wed, Fri",
                 "Sunday - Saturday",
                 "Mon, Tue, Thu, Fri",
                 "Mon, Tue, Wed, Sat"
                 )]
            string expectingString,
            [Values(
                 new[] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday },
                 new[] { DayOfWeek.Monday, DayOfWeek.Tuesday },
                 new [] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday },
                 new [] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday },
                 new[] { DayOfWeek.Monday, DayOfWeek.Wednesday, DayOfWeek.Friday, DayOfWeek.Sunday },
                 new [] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday },
                 new[] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Thursday, DayOfWeek.Friday },
                 new [] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Saturday }

                 )]
            DayOfWeek[] pDayOfWeekInput)
        {
            Assert.AreEqual(expectingString, dayListingFormatting.FormatDayListing(pDayOfWeekInput.ToList()));
        }
示例#2
0
        /* ---- WEEKLY ---- */

        private string BuildWeeklyDays(IRRuleTokenContainer tokenContainer)
        {
            var byDay = tokenContainer.GetByDay();

            if (byDay == null)
            {
                return("");
            }

            var result = _fragmentTranslator.GetTranslatedFragment(ETranslationFragment.ON) + " ";

            result += _dayListingFormatting.FormatDayListing(((ByDayToken.DayList)byDay.GetValue()).GetDayList().ToList());

            return(result);
        }