public void TestEveryWeekOnSaturdays() { //Arrange int numberOfRecurrences = 3; WeeklySchedule item = new WeeklySchedule { RecurrenceType = WeeklySchedule.RecurrenceTypeEnum.Weekly, WeeklyEveryNWeeks = 1, WeeklyDayOfWeekSunday = false, WeeklyDayOfWeekMonday = false, WeeklyDayOfWeekTuesday = false, WeeklyDayOfWeekWednesday = false, WeeklyDayOfWeekThursday = false, WeeklyDayOfWeekFriday = false, WeeklyDayOfWeekSaturday = true, RecurrenceStartDate = new DateTime(2019, 1, 5), RecurrenceEndAfterNSelected = true, RecurrenceEndAfterNOccurences = numberOfRecurrences }; int numberOfDaysSelected = 1; DateTime lastDate = item.NormalizeDate(item.RecurrenceStartDate.AddDays(((item.WeeklyEveryNWeeks * 7) * item.RecurrenceEndAfterNOccurences) - (item.WeeklyEveryNWeeks * 7) + numberOfDaysSelected - 1)); //Act item.ProcessFutureDates(); //Assert Assert.AreEqual(item.Name, "Weekly every " + item.WeeklyEveryNWeeks + " weeks, on Saturdays, for a total of " + item.RecurrenceEndAfterNOccurences * numberOfDaysSelected + " FutureDates"); DateTime[] dates = item.FutureDates.ToArray(); Assert.AreEqual(lastDate, dates[dates.Length - 1]); }