예제 #1
0
        public void GetNextDate_DayOfWeek_Exact()
        {
            MonthlyRecurrency monthly = new MonthlyRecurrency(new DateTime(2011, 4, 01), new DateTime(2011, 11, 30), 3, DayOfWeek.Monday, DayIndex.Third);

            Assert.AreEqual(new DateTime(2011, 4, 1), monthly.StartDate);
            Assert.AreEqual(new DateTime(2011, 4, 18), monthly.GetFirstDate());
            Assert.AreEqual(new DateTime(2011, 7, 18), monthly.GetNextDate(new DateTime(2011, 4, 18)));
            Assert.AreEqual(new DateTime(2011, 10, 17), monthly.GetNextDate(new DateTime(2011, 7, 18)));
            Assert.IsNull(monthly.GetNextDate(new DateTime(2011, 10, 17)));
        }
예제 #2
0
        public void GetNextDate_DayOfMonth_Exact()
        {
            MonthlyRecurrency monthly = new MonthlyRecurrency(new DateTime(2011, 1, 1), 4, 1, 15);

            Assert.AreEqual(new DateTime(2011, 1, 1), monthly.StartDate);
            Assert.AreEqual(new DateTime(2011, 1, 15), monthly.GetFirstDate());
            Assert.AreEqual(new DateTime(2011, 2, 15), monthly.GetNextDate(new DateTime(2011, 1, 15)));
            Assert.AreEqual(new DateTime(2011, 3, 15), monthly.GetNextDate(new DateTime(2011, 2, 15)));
            Assert.AreEqual(new DateTime(2011, 4, 15), monthly.GetNextDate(new DateTime(2011, 3, 15)));
            Assert.IsNull(monthly.GetNextDate(new DateTime(2011, 4, 15)));
        }
예제 #3
0
        public void GetFirstDate_DayOfWeek()
        {
            // April 2011
            // M  T  W  T  F  S  S
            //             1  2  3
            // 4  5  6  7  8  9  10
            // 11 12 13 14 15 16 17
            // 18 19 20 21 22 23 24
            // 25 26 27 28 29 30

            MonthlyRecurrency monthly = new MonthlyRecurrency(new DateTime(2011, 4, 01), new DateTime(2011, 11, 30), 1, DayOfWeek.Tuesday, DayIndex.Third);

            Assert.AreEqual(new DateTime(2011, 4, 19), monthly.GetFirstDate());
        }
예제 #4
0
        public void GetFirstDate_DayOfMonth_RollsIntoNextMonth()
        {
            MonthlyRecurrency monthly = new MonthlyRecurrency(new DateTime(2011, 2, 20), new DateTime(2011, 11, 30), 1, 14);

            Assert.AreEqual(new DateTime(2011, 3, 14), monthly.GetFirstDate()); // (2011, 2, 14) is before start date
        }
예제 #5
0
        public void GetFirstDate_DayOfMonth()
        {
            MonthlyRecurrency monthly = new MonthlyRecurrency(new DateTime(2011, 2, 01), new DateTime(2011, 11, 30), 1, 14);

            Assert.AreEqual(new DateTime(2011, 2, 14), monthly.GetFirstDate());
        }