public void GoMonth_SetMonth_ShouldntChange() { TimeWindowCore target = new TimeWindowCore(new DateTime(2012, 2, 2)); target.GoMonth(); target.GoMonth(); AssertDatesMatch(target, new DateTime(2012, 2, 1), new DateTime(2012, 2, 29), "remains feb"); }
public void GoPrevious_SetMonth_Goes() { TimeWindowCore target = new TimeWindowCore(new DateTime(2012, 5, 2)); target.GoMonth(); target.GoPrevious(); AssertDatesMatch(target, new DateTime(2012, 4, 1), new DateTime(2012, 4, 30), "End date 31 may. 30 april"); target.GoPrevious(); AssertDatesMatch(target, new DateTime(2012, 3, 1), new DateTime(2012, 3, 31), "End date 30 april. 31 march"); target.GoPrevious(); AssertDatesMatch(target, new DateTime(2012, 2, 1), new DateTime(2012, 2, 29), "end date 31 March 2012 -> 29 feb"); target.GoPrevious(); AssertDatesMatch(target, new DateTime(2012, 1, 1), new DateTime(2012, 1, 31), "end date 29 feb 2012 -> 31 jan"); target.GoPrevious(); AssertDatesMatch(target, new DateTime(2011, 12, 1), new DateTime(2011, 12, 31), "End date 31 Jan. 31 dec"); }
public void GoMonth_SetDays_Goes() { var target = new TimeWindowCore(new DateTime(2012, 2, 10)); target.GoMonth(); AssertDatesMatch(target, new DateTime(2012, 2, 1), new DateTime(2012, 2, 29), "10th feb falls in feb month"); target = new TimeWindowCore(new DateTime(2012, 3, 5)); target.GoMonth(); AssertDatesMatch(target, new DateTime(2012, 3, 1), new DateTime(2012, 3, 31), "5th march in March"); target = new TimeWindowCore(new DateTime(2012, 2, 29)); target.GoMonth(); AssertDatesMatch(target, new DateTime(2012, 2, 1), new DateTime(2012, 2, 29), "Leap year check. Falls in Feb"); }
public void GoWeek_SetMonth_Goes() { TimeWindowCore target = new TimeWindowCore(new DateTime(2012, 2, 2)); target.GoMonth(); target.GoWeek(); AssertDatesMatch(target, new DateTime(2012, 1, 29), new DateTime(2012, 2, 4), "1st week of feb"); }
public void GoMonth_SetYear_Goes() { TimeWindowCore target = new TimeWindowCore(new DateTime(2010, 4, 10)); target.GoYear(); target.GoMonth(); AssertDatesMatch(target, new DateTime(2010, 1, 1), new DateTime(2010, 1, 31), "Jan month"); }
public void GoYear_SetMonth_Goes() { TimeWindowCore target = new TimeWindowCore(new DateTime(2012, 2, 2)); target.GoMonth(); target.GoYear(); AssertDatesMatch(target, new DateTime(2012, 1, 1), new DateTime(2012, 12, 31), "2012 year"); }
public void GoDay_SetMonth_Goes() { TimeWindowCore target = new TimeWindowCore(new DateTime(2012, 2, 6)); target.GoMonth(); target.GoDay(); AssertDatesMatch(target, new DateTime(2012, 2, 1), new DateTime(2012, 2, 1), "1st day on month"); }
public void GetUberSpan_SetDates_Month() { var target = new TimeWindowCore(new DateTime(2012, 3, 3)); target.GoMonth(); Assert.AreEqual(target.GetUberSpan(), UberSpan.Month); target = new TimeWindowCore(new DateTime(2012, 3, 2)); target.GoMonth(); Assert.AreEqual(target.GetUberSpan(), UberSpan.Month); target = new TimeWindowCore(new DateTime(2012, 3, 1)); target.GoMonth(); Assert.AreEqual(target.GetUberSpan(), UberSpan.Month); }
public void StartEnd_SetDates_Month() { TimeWindowCore target = new TimeWindowCore(new DateTime(2012, 2, 29)); target.GoMonth(); AssertDatesMatch(target, new DateTime(2012, 2, 1), new DateTime(2012, 2, 29), "last day of month"); target = new TimeWindowCore(new DateTime(2012, 2, 1)); target.GoMonth(); AssertDatesMatch(target, new DateTime(2012, 2, 1), new DateTime(2012, 2, 29), "1st day of month"); }
public void GoMonth_SetWeek_Goes() { var target = new TimeWindowCore(new DateTime(2012, 2, 21)); target.GoWeek(); target.GoMonth(); AssertDatesMatch(target, new DateTime(2012, 2, 1), new DateTime(2012, 2, 29), "21 Feb will expand to 19 to 25 feb, will change to feb month"); target = new TimeWindowCore(new DateTime(2012, 3, 2)); target.GoWeek(); target.GoMonth(); AssertDatesMatch(target, new DateTime(2012, 2, 1), new DateTime(2012, 2, 29), "2nd march will expand to 26feb - 3 mar will change to feb month"); }
public void GoNext_SetMonth_Goes() { TimeWindowCore target = new TimeWindowCore(new DateTime(2012, 1, 2)); target.GoMonth(); target.GoNext(); AssertDatesMatch(target, new DateTime(2012, 2, 1), new DateTime(2012, 2, 29), "End date 31 jan. add month? 29 feb"); target.GoNext(); AssertDatesMatch(target, new DateTime(2012, 3, 1), new DateTime(2012, 3, 31), "end date 29 feb 2012 -> march"); target.GoNext(); AssertDatesMatch(target, new DateTime(2012, 4, 1), new DateTime(2012, 4, 30), "end date 30 april 2012"); }