예제 #1
0
        public void OccursOnDateTest()
        {
            DateTime startDate = new DateTime(2014, 5, 22);
            DateTime endDate   = startDate.AddDays(1);

            Recurrence recur = new Recurrence();

            recur.Day  = "135";
            recur.Week = 2;
            recur.End  = RepeatEnd.None;
            recur.Type = RepeatType.Weekly;

            DateTime?repDate;

            Assert.IsTrue(recur.OccursOnDate(new DateTime(2014, 5, 23), startDate, endDate, true, out repDate));

            Assert.IsFalse(recur.OccursOnDate(new DateTime(2014, 5, 26), startDate, endDate, true, out repDate));

            Assert.IsFalse(recur.OccursOnDate(new DateTime(2014, 5, 28), startDate, endDate, true, out repDate));

            Assert.IsFalse(recur.OccursOnDate(new DateTime(2014, 5, 30), startDate, endDate, true, out repDate));

            Assert.IsTrue(recur.OccursOnDate(new DateTime(2014, 6, 2), startDate, endDate, true, out repDate));

            Assert.IsTrue(recur.OccursOnDate(new DateTime(2014, 6, 4), startDate, endDate, true, out repDate));

            Assert.IsTrue(recur.OccursOnDate(new DateTime(2014, 6, 6), startDate, endDate, true, out repDate));
        }