public void MsSqlCondition_ForToDateRange_ShouldReturnExpected() { var expected = $"{columnDate} < '2016-01-16 00:00:00.000'"; var range = new ToDateRange(new Date(2016, 1, 15)); var result = range.GetMsSqlCondition(columnDate); Assert.AreEqual(expected, result); }
public void ManualTestOfAMonthDuration() { var snapped = ToDateRange.SnapToDateRanges( new[] { DateTimeOffset.Parse("10/18/2020") }, o => o, DateTimeOffset.Parse("1/1/1990"), // Accounts for leap years TimeSpan.FromDays(30.4375)) .Keys .Single(); }
public void OverlapsEnd() { var snapped = ToDateRange.SnapToDateRanges( new[] { DateTimeOffset.Parse("1/18/2020") }, o => o, DateTimeOffset.Parse("1/11/2020"), TimeSpan.FromDays(7)) .Keys .Single(); Assert.AreEqual(DateTimeOffset.Parse("1/18/2020"), snapped.StartInclusive); Assert.AreEqual(DateTimeOffset.Parse("1/25/2020"), snapped.EndExclusive); }
public void MuchFarBefore() { var snapped = ToDateRange.SnapToDateRanges( new[] { DateTimeOffset.Parse("1/18/2020") }, o => o, // A Monday DateTimeOffset.Parse("2/9/1920"), TimeSpan.FromDays(7)) .Keys .Single(); Assert.AreEqual(DateTimeOffset.Parse("1/13/2020"), snapped.StartInclusive); Assert.AreEqual(DateTimeOffset.Parse("1/20/2020"), snapped.EndExclusive); }