public void RepeatChore_EveryMonWedFri_ShouldOccurOnMonWedFri() { int daysOfWeek = DaysOfWeekUtils.valueOf(new DayOfWeek[] { DayOfWeek.Monday, DayOfWeek.Wednesday, DayOfWeek.Friday }); var chore = new ChoreBuilder() .WithRepeating(1, Models.RepeatingUnitType.Week) .WithDaysOfWeek(daysOfWeek) .Build(); // spin through a week and check we have an occurance on the right days DateTime checkDate = DateTime.Now.Date; for (int i = 0; i < 7; i++) { if ((checkDate.DayOfWeek == DayOfWeek.Monday) || (checkDate.DayOfWeek == DayOfWeek.Wednesday) || (checkDate.DayOfWeek == DayOfWeek.Friday)) { chore.RecursOnDate(checkDate).ShouldBeTrue(); } else { chore.RecursOnDate(checkDate).ShouldBeFalse(); } checkDate = checkDate.AddDays(1); } }
public void RepeatChore_EverySaturday_ShouldBeActiveNextOnSaturday() { var chore = new ChoreBuilder() .WithRepeating(1, Models.RepeatingUnitType.Week) .WithDaysOfWeek(DaysOfWeekUtils.valueOf(DayOfWeek.Saturday)) .Build(); DateTime checkDate = DateTime.Now.Date; for (int i = 0; i < 7; i++) { if (checkDate.DayOfWeek == DayOfWeek.Saturday) { chore.RecursOnDate(checkDate).ShouldBeTrue(); } else { chore.RecursOnDate(checkDate).ShouldBeFalse(); } checkDate = checkDate.AddDays(1); } }