private static IList <TimeSpan> GetTimes(string input)
        {
            var times = input
                        .Split(new[] { " ", "," }, StringSplitOptions.RemoveEmptyEntries)
                        .Select(s => s.Trim())
                        .Select(s => DateStringParser.ParseTime(s).TimeOfDay)
                        .ToList();

            return(times);
        }
Ejemplo n.º 2
0
        public static CronTemplate ForDays(DaysOfWeek daysOfWeek, string time)
        {
            var daysOfWeekList = GetDaysListFromEnum(daysOfWeek);
            var timeValue      = DateStringParser.ParseTime(time);
            var cronTemplate   = new CronTemplateBuilder()
                                 .WithMinutes(timeValue.Minute)
                                 .WithHours(timeValue.Hour)
                                 .WithAllDaysOfMonth()
                                 .WithDaysOfWeek(daysOfWeekList.ToArray())
                                 .WithAllMonths()
                                 .Build();

            return(cronTemplate);
        }
Ejemplo n.º 3
0
        private void Test(string s, DateTime dateTime)
        {
            var time = DateStringParser.ParseTime(s);

            time.TimeOfDay.Should().Be(dateTime.TimeOfDay);
        }