示例#1
0
        public void GetInstance_WhenCalledWithZeroIndex_MatchesFirstYieldedInstance()
        {
            var rep = new RepetitionSchedule(
                new SingleDaySchedule(DateTime.MinValue),
                DateUnit.Days,
                1);

            var first = rep.YieldAllInstances().First();
            var zero  = rep.GetInstance(0);

            Assert.That(zero, Is.EqualTo(first));
        }
示例#2
0
        public void YieldAllInstances_WhenCalledOnNestedRepetitions_ReturnsDatesInOrder()
        {
            var rep = new RepetitionSchedule(
                new RepetitionSchedule(
                    new SingleDaySchedule(DateTime.MinValue),
                    DateUnit.Hours,
                    1),
                DateUnit.Days,
                1);

            var previousDate = DateTime.MinValue;

            foreach (var d in rep.YieldAllInstances().Take(1000))
            {
                Assert.That(d, Is.GreaterThanOrEqualTo(previousDate));
                previousDate = d;
            }
        }