예제 #1
0
        /// <summary>
        /// Determine the next UTC time (in milliseconds) that is 'included' by the
        /// Calendar after the given time. Return the original value if timeStamp is
        /// included. Return 0 if all days are excluded.
        /// </summary>
        /// <seealso cref="ICalendar.GetNextIncludedTimeUtc" />
        public virtual DateTimeOffset GetNextIncludedTimeUtc(DateTimeOffset timeUtc)
        {
            if (timeUtc == DateTimeOffset.MinValue)
            {
                throw new ArgumentException("timeStamp must be greater DateTimeOffset.MinValue");
            }

            if (baseCalendar != null)
            {
                return(baseCalendar.GetNextIncludedTimeUtc(timeUtc));
            }

            return(timeUtc);
        }
        public void RetrieveCalendarSuccessfully()
        {
            //arrange
            ICalendar calendar = CreateCalendar();

            JobStore.StoreCalendar(CalendarName, calendar, true, false);

            //act
            ICalendar retrievedCalendar = JobStore.RetrieveCalendar(CalendarName).Result;

            //assert
            Assert.AreEqual(calendar.Description, retrievedCalendar.Description);
            DateTimeOffset utcNow = new DateTimeOffset(DateTime.UtcNow);

            Assert.AreEqual(calendar.GetNextIncludedTimeUtc(utcNow), retrievedCalendar.GetNextIncludedTimeUtc(utcNow));
        }
예제 #3
0
 public virtual DateTime GetNextIncludedTimeUtc(DateTime timeStamp)
 {
     return(calendar.GetNextIncludedTimeUtc(timeStamp));
 }