public void Should_Happen_During() { var d = new DateTimeOffsetRange(Now, OneDayAfterNow); d.HappenedDuring(Now.AddHours(1)).Should().BeTrue(); d.HappenedDuring(Now).Should().BeTrue(); // date at begin of range is included d.HappenedDuring(OneDayAfterNow).Should().BeTrue(); // date at end of range is included }
/// <summary> /// Evaluates if the datetime instance, did happen during the given period. /// </summary> public static bool HappenedDuring(this DateTimeOffset @this, DateTimeOffsetRange period) { if (period == null) { throw new ArgumentNullException(nameof(period)); } return(period.HappenedDuring(@this)); }