public void Set_MinuteCycleFunc_ReturnTrue(int startTime, int endTime)
        {
            string result = CronExpressionHelper.Set(i => i.SetMinuteCycle(startTime, endTime));

            var instant = GetInstant;

            instant[1] = $"{startTime}-{endTime}";

            Assert.Equal(string.Join(" ", instant), result);
        }
        public void Set_MinuteGap_ReturnTrue(int gapTime, int startTime)
        {
            string result = CronExpressionHelper.SetMinuteGap(gapTime, startTime);

            var instant = GetInstant;

            instant[1] = $"{startTime}/{gapTime}";

            Assert.Equal(string.Join(" ", instant), result);
        }
        public void Set_SpecificHour_ReturnTrue(params int[] input)
        {
            string result = CronExpressionHelper.SetSpecificHour(input);

            var instant = GetInstant;

            instant[2] = string.Join(",", input);

            Assert.Equal(string.Join(" ", instant), result);
        }
        public void Set_MonthCycle_ReturnTrue(int startTime, int endTime)
        {
            var result = CronExpressionHelper.SetMonthCycle(startTime, endTime);

            var instant = GetInstant;

            instant[4] = $"{startTime}-{endTime}";

            Assert.Equal(string.Join(" ", instant), result);
        }
        public void Set_SpecificMinuteFunc_ReturnTrue(params int[] input)
        {
            string result = CronExpressionHelper.Set(i => i.SetSpecificMinute(input));

            var instant = GetInstant;

            instant[1] = string.Join(",", input);

            Assert.Equal(string.Join(" ", instant), result);
        }
        public void Set_MonthGapFunc_ReturnTrue(int gapTime, int startTime)
        {
            string result = CronExpressionHelper.Set(i => i.SetMonthGap(gapTime, startTime));

            var instant = GetInstant;

            instant[4] = $"{startTime}/{gapTime}";

            Assert.Equal(string.Join(" ", instant), result);
        }
Beispiel #7
0
        public void Set_DayAndHourGap_ReturnTrue(int gapTime, int startTime)
        {
            string result = CronExpressionHelper.Set(i => i.SetDayGap(gapTime, startTime), i => i.SetHourGap(12));

            var instant = GetInstant;

            instant[2] = $"0/12";

            instant[3] = $"{startTime}/{gapTime}";

            Assert.Equal(string.Join(" ", instant), result);
        }
        public void Set_HourAndMinuteGap_ReturnTrue(int gapTime, int startTime)
        {
            string result = CronExpressionHelper.Set(i => i.SetHourGap(gapTime, startTime), i => i.SetMinuteGap(30));

            var instant = GetInstant;

            instant[1] = $"0/30";

            instant[2] = $"{startTime}/{gapTime}";

            Assert.Equal(string.Join(" ", instant), result);
        }
Beispiel #9
0
        public void Set_DayAndHourCycle_ReturnTrue(int startTime, int endTime)
        {
            string result = CronExpressionHelper.Set(i => i.SetDayCycle(startTime, endTime), i => i.SetHourCycle(1, 2));

            var instant = GetInstant;

            instant[2] = $"1-2";

            instant[3] = $"{startTime}-{endTime}";

            Assert.Equal(string.Join(" ", instant), result);
        }
Beispiel #10
0
        public void Set_Example3_ReturnTrue()
        {
            var result = CronExpressionHelper.Set(i => i.SetSpecificDay(1), i => i.SetSpecificHour(2));

            Assert.Equal("0 0 2 1 * ? *", result);

            var cron = CronExpressionHelper.GetInstant;

            var result1 = cron.SetSpecificDay(1)
                          .SetSpecificHour(2).Result;

            Assert.Equal("0 0 2 1 * ? *", result1);
        }
        /// <summary>
        /// Get all active scrum of next hour from storage and schedule based on given start time.
        /// For ex: If current UTC time is 10.00 AM, this will fetch scrums scheduled for 11.00 AM and 11.30 AM from storage by UTC hour calculated as 11.
        /// </summary>
        /// <returns>A task that schedules scrum.</returns>
        private async Task GetAllScrumDetailAndScheduleAsync()
        {
            var scrumMasterDetails = await this.scrumMasterStorageProvider.GetActiveScrumMasterOfNextHourAsync();

            if (scrumMasterDetails != null)
            {
                foreach (var scrumMaster in scrumMasterDetails)
                {
                    CronExpression expression = CronExpressionHelper.CreateCronExpression(DateTimeOffset.Parse(scrumMaster.StartTime, CultureInfo.InvariantCulture));
                    await this.ScheduleScrumAsync(expression, scrumMaster);
                }
            }
        }
Beispiel #12
0
        public void Set_Example9_ReturnTrue()
        {
            var result = CronExpressionHelper.Set(i => i.SetWeekCycle(2, 6), i => i.SetSpecificHour(10), i => i.SetSpecificMinute(15));

            Assert.Equal("0 15 10 ? * 2-6 *", result);
        }
        public void Set_WrongMonthCycle_ReturnFalse(int startTime, int endTime)
        {
            Action action = () => CronExpressionHelper.SetMonthCycle(startTime, endTime);

            Assert.Throws <Exception>(action);
        }
Beispiel #14
0
        public void Set_WrongDayAndHourCycle_ReturnFalse(int startTime, int endTime)
        {
            Action action = () => CronExpressionHelper.Set(i => i.SetDayCycle(startTime, endTime), i => i.SetHourCycle(1, 2));

            Assert.Throws <Exception>(action);
        }
        public void Set_WrongMonthGapFunc_ReturnFalse(int gapTime, int startTime)
        {
            Action action = () => CronExpressionHelper.Set(i => i.SetMonthGap(gapTime, startTime));

            Assert.Throws <Exception>(action);
        }
        public void Set_WrongSpecificHourAndMinute_ReturnFalse(params int[] input)
        {
            Action action = () => CronExpressionHelper.Set(i => i.SetSpecificHour(input), i => i.SetSpecificMinute(10));

            Assert.Throws <IndexOutOfRangeException>(action);
        }
Beispiel #17
0
        public void Set_WrongSpecificSecondFunc_ReturnTrue(params int[] input)
        {
            Action action = () => CronExpressionHelper.Set(i => i.SetSpecificSecond(input));

            Exception exception = Assert.Throws <IndexOutOfRangeException>(action);
        }
        public void Set_WrongHourAndMinuteGap_ReturnTrue(int gapTime, int startTime)
        {
            Action action = () => CronExpressionHelper.Set(i => i.SetHourGap(gapTime, startTime), i => i.SetMinuteGap(30));

            Assert.Throws <Exception>(action);
        }
Beispiel #19
0
        public void Set_Example11_ReturnTrue()
        {
            var result = CronExpressionHelper.Set(i => i.SetLastDayOfWeek(ScheduleDayOfWeek.Friday), i => i.SetSpecificHour(10), i => i.SetSpecificMinute(15));

            Assert.Equal("0 15 10 ? * 6L *", result);
        }
Beispiel #20
0
        public void Set_Example10_ReturnTrue()
        {
            var result = CronExpressionHelper.Set(i => i.SetLastDayOfMonth(), i => i.SetSpecificHour(10), i => i.SetSpecificMinute(15));

            Assert.Equal("0 15 10 L * ? *", result);
        }
        public void Set_WrongSpecificWeek_ReturnFalse(params int[] input)
        {
            Action action = () => CronExpressionHelper.SetSpecificWeek(input);

            Assert.Throws <IndexOutOfRangeException>(action);
        }
Beispiel #22
0
        public void Set_Example8_ReturnTrue()
        {
            var result = CronExpressionHelper.Set(i => i.SetSpecificHour(14), i => i.SetMinuteGap(5));

            Assert.Equal("0 0/5 14 * * ? *", result);
        }
Beispiel #23
0
        public void Set_Example2_ReturnTrue()
        {
            var result = CronExpressionHelper.SetMinuteGap(2);

            Assert.Equal("0 0/2 * * * ? *", result);
        }
Beispiel #24
0
        public void Set_Example1_ReturnTrue()
        {
            var result = CronExpressionHelper.SetSecondGap(2);

            Assert.Equal("0/2 * * * * ? *", result);
        }
        public void Set_WrongSpecificMinuteFunc_ReturnTrue(params int[] input)
        {
            Action action = () => CronExpressionHelper.SetSpecificMinute(input);

            Assert.Throws <IndexOutOfRangeException>(action);
        }
Beispiel #26
0
        public void Set_Example5_ReturnTrue()
        {
            var result = CronExpressionHelper.SetSpecificHour(10, 14, 16);

            Assert.Equal("0 0 10,14,16 * * ? *", result);
        }
        public void Set_WrongMinuteAndSecondFunc_ReturnFalse(int startTime, int endTime)
        {
            Action action = () => CronExpressionHelper.Set(i => i.SetMinuteCycle(startTime, endTime));

            Assert.Throws <Exception>(action);
        }
Beispiel #28
0
        public void Set_Example6_ReturnTrue()
        {
            var result = CronExpressionHelper.Set(i => i.SetHourCycle(9, 17), i => i.SetMinuteGap(30));

            Assert.Equal("0 0/30 9-17 * * ? *", result);
        }
        public void Set_WrongMinuteGap_ReturnFalse(int gapTime, int startTime)
        {
            Action action = () => CronExpressionHelper.SetMinuteGap(gapTime, startTime);

            Assert.Throws <Exception>(action);
        }
Beispiel #30
0
        public void Set_Example7_ReturnTrue()
        {
            var result = CronExpressionHelper.Set(i => i.SetSpecificWeek(ScheduleDayOfWeek.Wednesday), i => i.SetSpecificHour(12));

            Assert.Equal("0 0 12 ? * 4 *", result);
        }