示例#1
0
        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);
        }
示例#2
0
 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();
 }
示例#3
0
            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);
            }
示例#4
0
            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);
            }