Exemplo n.º 1
0
        public void GetNextDate_Xis5_Exact()
        {
            DailyRecurrency daily = new DailyRecurrency(new DateTime(2011, 4, 5), new DateTime(2011, 4, 25), DailyType.EveryXDays, 5);

            Assert.AreEqual(new DateTime(2011, 4, 5), daily.StartDate);
            Assert.AreEqual(new DateTime(2011, 4, 5), daily.GetFirstDate());
            Assert.AreEqual(new DateTime(2011, 4, 10), daily.GetNextDate(new DateTime(2011, 4, 5)));
            Assert.AreEqual(new DateTime(2011, 4, 15), daily.GetNextDate(new DateTime(2011, 4, 10)));
            Assert.AreEqual(new DateTime(2011, 4, 20), daily.GetNextDate(new DateTime(2011, 4, 15)));
            Assert.AreEqual(new DateTime(2011, 4, 25), daily.GetNextDate(new DateTime(2011, 4, 20)));
            Assert.AreEqual(null, daily.GetNextDate(new DateTime(2011, 4, 25)));
        }
Exemplo n.º 2
0
        public void GetNextDate_Xis1()
        {
            DailyRecurrency daily = new DailyRecurrency(new DateTime(2011, 4, 1), 5, DailyType.EveryXDays, 1);

            Assert.AreEqual(new DateTime(2011, 4, 1), daily.StartDate);
            Assert.AreEqual(new DateTime(2011, 4, 1), daily.GetFirstDate());
            Assert.AreEqual(new DateTime(2011, 4, 2), daily.GetNextDate(new DateTime(2011, 4, 1)));
            Assert.AreEqual(new DateTime(2011, 4, 3), daily.GetNextDate(new DateTime(2011, 4, 2)));
            Assert.AreEqual(new DateTime(2011, 4, 4), daily.GetNextDate(new DateTime(2011, 4, 3)));
            Assert.AreEqual(new DateTime(2011, 4, 5), daily.GetNextDate(new DateTime(2011, 4, 4)));
            Assert.AreEqual(null, daily.GetNextDate(new DateTime(2011, 4, 5)));
        }
Exemplo n.º 3
0
        public void GetNextDate_Xis5_Inexact()
        {
            DailyRecurrency daily = new DailyRecurrency(new DateTime(2011, 4, 5), new DateTime(2011, 4, 15), DailyType.EveryXDays, 5);

            Assert.AreEqual(new DateTime(2011, 4, 05), daily.GetNextDate(new DateTime(2011, 4, 3)));
            Assert.AreEqual(new DateTime(2011, 4, 05), daily.GetNextDate(new DateTime(2011, 4, 4)));

            Assert.AreEqual(new DateTime(2011, 4, 10), daily.GetNextDate(new DateTime(2011, 4, 5)));
            Assert.AreEqual(new DateTime(2011, 4, 10), daily.GetNextDate(new DateTime(2011, 4, 9)));

            Assert.AreEqual(new DateTime(2011, 4, 15), daily.GetNextDate(new DateTime(2011, 4, 10)));
            Assert.AreEqual(new DateTime(2011, 4, 15), daily.GetNextDate(new DateTime(2011, 4, 14)));

            Assert.AreEqual(null, daily.GetNextDate(new DateTime(2011, 4, 15)));
            Assert.AreEqual(null, daily.GetNextDate(new DateTime(2011, 4, 16)));
        }
Exemplo n.º 4
0
        public void GetNextDate_Weeky()
        {
            DailyRecurrency daily = new DailyRecurrency(new DateTime(2011, 4, 1), 5, DailyType.Weekdays);

            Assert.AreEqual(new DateTime(2011, 4, 1), daily.StartDate);
            Assert.AreEqual(new DateTime(2011, 4, 1), daily.GetFirstDate());                        //fri
            Assert.AreEqual(new DateTime(2011, 4, 4), daily.GetNextDate(new DateTime(2011, 4, 1))); // fri -> mon
            Assert.AreEqual(new DateTime(2011, 4, 4), daily.GetNextDate(new DateTime(2011, 4, 2))); // sat -> mon
            Assert.AreEqual(new DateTime(2011, 4, 4), daily.GetNextDate(new DateTime(2011, 4, 3))); // sun -> mon
            Assert.AreEqual(new DateTime(2011, 4, 5), daily.GetNextDate(new DateTime(2011, 4, 4))); // mon -> tues
            Assert.AreEqual(new DateTime(2011, 4, 6), daily.GetNextDate(new DateTime(2011, 4, 5))); // mon -> tues
            Assert.AreEqual(new DateTime(2011, 4, 7), daily.GetNextDate(new DateTime(2011, 4, 6))); // mon -> tues
            Assert.AreEqual(null, daily.GetNextDate(new DateTime(2011, 4, 7)));
        }