Esempio n. 1
0
        public Occurance?GetRepeatOccurance(IsoDayOfWeek day)
        {
            if (this.BaseOccurance == null)
            {
                return(null);
            }

            Occurance?repeat = this.GetRepeat(day);

            if (repeat == null)
            {
                return(null);
            }

            LocalDateTime nowLocal = TimeUtils.Now.InUtc().LocalDateTime;

            LocalDate nextDay;

            if (nowLocal.DayOfWeek == day)
            {
                nextDay = nowLocal.Date;

                if (repeat.GetInstant(nextDay) < TimeUtils.Now)
                {
                    nextDay = nowLocal.Next(day).Date;
                }
            }
            else
            {
                nextDay = nowLocal.Next(day).Date;
            }

            return(new Occurance(repeat, nextDay, this.BaseOccurance));
        }
        public int Next(int dayOfMonth, IsoDayOfWeek targetDayOfWeek)
        {
            LocalDateTime start  = new LocalDateTime(2011, 11, dayOfMonth, 15, 25, 30, 100, 5000);
            LocalDateTime target = start.Next(targetDayOfWeek);

            Assert.AreEqual(2011, target.Year);
            Assert.AreEqual(11, target.Month);
            Assert.AreEqual(start.TimeOfDay, target.TimeOfDay);
            return(target.Day);
        }
Esempio n. 3
0
        public int Next(int dayOfMonth, IsoDayOfWeek targetDayOfWeek)
        {
            LocalDateTime start  = new LocalDateTime(2011, 11, dayOfMonth, 15, 25, 30).PlusNanoseconds(123456789);
            LocalDateTime target = start.Next(targetDayOfWeek);

            Assert.AreEqual(2011, target.Year);
            Assert.AreEqual(11, target.Month);
            Assert.AreEqual(start.TimeOfDay, target.TimeOfDay);
            return(target.Day);
        }
Esempio n. 4
0
        public LocalDateTime?ComputeNextExecutionTime(LocalDateTime lastExecutionTime)
        {
            var currentWeekExecutionTime = new LocalDateTime(lastExecutionTime.Year, lastExecutionTime.Month, lastExecutionTime.Day, this._hourOfDay, this._minuteOfHour);

            if (lastExecutionTime.DayOfWeek == this._dayOfWeek &&
                lastExecutionTime < currentWeekExecutionTime)
            {
                return(currentWeekExecutionTime);
            }

            return(currentWeekExecutionTime.Next(this._dayOfWeek));
        }
        public void Next_InvalidArgument(IsoDayOfWeek targetDayOfWeek)
        {
            LocalDateTime start = new LocalDateTime(2011, 1, 1, 15, 25, 30, 100, 5000);

            Assert.Throws <ArgumentOutOfRangeException>(() => start.Next(targetDayOfWeek));
        }
Esempio n. 6
0
        public void Next_InvalidArgument(IsoDayOfWeek targetDayOfWeek)
        {
            LocalDateTime start = new LocalDateTime(2011, 1, 1, 15, 25, 30).PlusNanoseconds(123456789);

            Assert.Throws <ArgumentOutOfRangeException>(() => start.Next(targetDayOfWeek));
        }
 public void Next_InvalidArgument(IsoDayOfWeek targetDayOfWeek)
 {
     LocalDateTime start = new LocalDateTime(2011, 1, 1, 15, 25, 30, 100, 5000);
     Assert.Throws<ArgumentOutOfRangeException>(() => start.Next(targetDayOfWeek));
 }
 public int Next(int dayOfMonth, IsoDayOfWeek targetDayOfWeek)
 {
     LocalDateTime start = new LocalDateTime(2011, 11, dayOfMonth, 15, 25, 30, 100, 5000);
     LocalDateTime target = start.Next(targetDayOfWeek);
     Assert.AreEqual(2011, target.Year);
     Assert.AreEqual(11, target.Month);
     Assert.AreEqual(start.TimeOfDay, target.TimeOfDay);
     return target.Day;
 }