Exemplo n.º 1
0
        public void SchedulingOccurrenceGeneratorReturnsOccurrencesInOneWeekWhenMatchesFirstDateInRange()
        {
            var dateStart   = new DateTime(2017, 8, 17); //Thursay
            var dateEnd     = new DateTime(2017, 8, 23); //Wednesday
            var generator   = new OccurrencesGenerator();
            var occurrences = generator.CreateWeeklyOccurrencies(dateStart, dateEnd, DayOfWeek.Thursday);

            Assert.IsTrue(occurrences.Count() == 1);
            Assert.AreEqual(dateStart, occurrences.First().Date);
        }
Exemplo n.º 2
0
        public void SchedulingOccurrenceGeneratorReturnsEmptyList()
        {
            var dateStart    = new DateTime(2017, 8, 17); //Thursay
            var dateEnd      = new DateTime(2017, 8, 21); //Monday
            var expectedDate = new DateTime(2017, 8, 22); //Tuesday
            var generator    = new OccurrencesGenerator();
            var occurrences  = generator.CreateWeeklyOccurrencies(dateStart, dateEnd, DayOfWeek.Tuesday);

            Assert.IsTrue(occurrences.Count() == 0);
        }
Exemplo n.º 3
0
        public void SchedulingOccurencesGeneratorReturnsOccurrencesInOneWeek()
        {
            var dateStart    = new DateTime(2017, 8, 17); //Thursay
            var dateEnd      = new DateTime(2017, 8, 23); //Wednesday
            var expectedDate = new DateTime(2017, 8, 21); // Monday
            var generator    = new OccurrencesGenerator();
            var occurrences  = generator.CreateWeeklyOccurrencies(dateStart, dateEnd, DayOfWeek.Monday);

            Assert.IsTrue(occurrences.Count() == 1);
            Assert.AreEqual(expectedDate, occurrences.First().Date);
        }
Exemplo n.º 4
0
        public void SchedulingOccurrenceGeneratorReturnsAllMondaysInMonth()
        {
            var dateStart   = new DateTime(2017, 8, 1);  //Tuesday
            var dateEnd     = new DateTime(2017, 8, 31); //Thursday
            var generator   = new OccurrencesGenerator();
            var occurrences = generator.CreateWeeklyOccurrencies(dateStart, dateEnd, DayOfWeek.Monday);

            Assert.IsTrue(occurrences.Count() == 4);
            Assert.IsTrue(occurrences.Any(m => m == new DateTime(2017, 8, 7)));
            Assert.IsTrue(occurrences.Any(m => m == new DateTime(2017, 8, 14)));
            Assert.IsTrue(occurrences.Any(m => m == new DateTime(2017, 8, 21)));
            Assert.IsTrue(occurrences.Any(m => m == new DateTime(2017, 8, 28)));
        }