Example #1
0
        public void GetNextDateAfter_RepeatEveryWeekDay()
        {
            // Arrange.
            var target = new DailyPattern { RepeatEveryWeekDay = true };
            var afterDate = new DateTime(2013, 1, 14); // Monday.

            // Act.
            var result = target.GetNextDateAfter(afterDate);

            // Assert.
            var expected = new DateTime(2013, 1, 15); // Tuesday.
            Assert.AreEqual(expected, result);

            // Arrange.
            target = new DailyPattern { RepeatEveryWeekDay = true };
            afterDate = new DateTime(2013, 1, 18); // Friday.

            // Act.
            result = target.GetNextDateAfter(afterDate);

            // Assert.
            expected = new DateTime(2013, 1, 21); // Monday.
            Assert.AreEqual(expected, result);

            // Arrange.
            target = new DailyPattern { RepeatEveryWeekDay = true };
            afterDate = new DateTime(2013, 1, 20); // Sunday.

            // Act.
            result = target.GetNextDateAfter(afterDate);

            // Assert.
            expected = new DateTime(2013, 1, 21); // Monday.
            Assert.AreEqual(expected, result);
        }
Example #2
0
        public void GetNextDateAfter_RepeatEveryNDay()
        {
            // Arrange.
            var target = new DailyPattern();
            var afterDate = new DateTime(2013, 1, 16); // Wednesday.

            // Act.
            var result = target.GetNextDateAfter(afterDate);

            // Assert.
            var expected = new DateTime(2013, 1, 17); // Thursday.
            Assert.AreEqual(expected, result);

            // Arrange.
            target = new DailyPattern();
            afterDate = new DateTime(2013, 1, 18); // Friday.

            // Act.
            result = target.GetNextDateAfter(afterDate);

            // Assert.
            expected = new DateTime(2013, 1, 19); // Saturday.
            Assert.AreEqual(expected, result);

            // Arrange.
            target = new DailyPattern { RepeatEveryNDay = 3 };
            afterDate = new DateTime(2013, 1, 17); // Thursday.

            // Act.
            result = target.GetNextDateAfter(afterDate);

            // Assert.
            expected = new DateTime(2013, 1, 20); // Sunday.
            Assert.AreEqual(expected, result);
        }