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 OnceOffChore_ForYesterday_ShouldNotBeActiveToday() { var chore = new ChoreBuilder() .OnceOff(DateTime.Today.AddDays(-1)) .Build(); chore.RecursOnDate(DateTime.Now).ShouldBeFalse(); }
public void OnceOffChore_ForToday_ShouldNotBeActiveTomorrow() { var chore = new ChoreBuilder() .OnceOff(DateTime.Today) .Build(); chore.RecursOnDate(DateTime.Now.AddDays(1)).ShouldBeFalse(); }
public void OnceOffChore_ForToday_ShouldBeActiveForToday() { var chore = new ChoreBuilder() .OnceOff(DateTime.Today) .Build(); chore.RecursOnDate(DateTime.Now).ShouldBeTrue(); }
public void DailyRepeatChore_StartingToday_ShouldStillBeActiveNextWeek() { var chore = new ChoreBuilder() .WithRepeating(1, Models.RepeatingUnitType.Day) .WithStartDate(DateTime.Now) .Build(); chore.RecursOnDate(DateTime.Now.AddDays(7)).ShouldBeTrue(); }
public void DailyRepeatChore_StartingTomorrow_ShouldNotBeActiveTomorrow() { var chore = new ChoreBuilder() .WithRepeating(1, Models.RepeatingUnitType.Day) .WithStartDate(DateTime.Now.AddDays(1)) .Build(); chore.RecursOnDate(DateTime.Now.AddDays(1)).ShouldBeTrue(); }
public void DailyRepeatChore_FromYesterday_ShouldBeActiveToday() { var chore = new ChoreBuilder() .WithRepeating(1, Models.RepeatingUnitType.Day) .WithStartDate(DateTime.Now.AddDays(-1)) .Build(); chore.RecursOnDate(DateTime.Now).ShouldBeTrue(); }
public void OnceOffChore_ForTodayButInactive_ShouldNotBeActiveToday() { var chore = new ChoreBuilder() .OnceOff(DateTime.Today) .WithActive(false) .Build(); chore.RecursOnDate(DateTime.Now).ShouldBeFalse(); }
public void RepeatChore_EverySecondDay_ShouldBeActiveTodayButNotTomorrow() { var chore = new ChoreBuilder() .WithRepeating(2, Models.RepeatingUnitType.Day) .WithStartDate(DateTime.Now) .Build(); // should be active today chore.RecursOnDate(DateTime.Now).ShouldBeTrue(); // should not be active tomorrow chore.RecursOnDate(DateTime.Now.AddDays(1)).ShouldBeFalse(); // should be active again the day after chore.RecursOnDate(DateTime.Now.AddDays(2)).ShouldBeTrue(); }
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); } }
public void DailyRepeatChore_ShouldBeActive() { var chore = new ChoreBuilder().WithRepeating(1, Models.RepeatingUnitType.Day).Build(); chore.RecursOnDate(DateTime.Now).ShouldBeTrue(); }