public void AddDaysReturnsCorrectRange() { // arrange var startingRange = DateTimeRange.GetWeek(new DateTime(2016, 2, 15), DayOfWeek.Monday); // act var newRange = startingRange.AddDays(30); // assert newRange.StartDate.ShouldBeEquivalentTo(new DateTime(2016, 3, 16)); newRange.EndDate.ShouldBeEquivalentTo(new DateTime(2016, 3, 22)); }
public void AddWeeksReturnsCorrectRangeInCompleteWeeks() { // arrange var startRange = DateTimeRange.GetWeek(new DateTime(2016, 2, 15), DayOfWeek.Monday); // act var result = startRange.AddWeeks(3, DayOfWeek.Monday); // assert result.StartDate.ShouldBeEquivalentTo(new DateTime(2016, 3, 7), "Start day should have been march 7"); result.EndDate.ShouldBeEquivalentTo(new DateTime(2016, 3, 13), "End day should have been march 13"); }
public void GetWeekReturnsCorrectRange() { // arrange var dayMember = new DateTime(2016, 1, 17); // act var range = DateTimeRange.GetWeek(dayMember, DayOfWeek.Monday); // assert range.StartDate.ShouldBeEquivalentTo(new DateTime(2016, 1, 11)); range.EndDate.ShouldBeEquivalentTo(new DateTime(2016, 1, 17)); }