public void FixTo() { var ex = new TimeExpression("time < 1455376521s"); ex.From.Should().Be(null); ex.To.Should().Be(new DateTime(2016, 2, 13, 16, 15, 21, DateTimeKind.Local).ToUniversalTime()); }
public void FixFrom() { var ex = new TimeExpression("time > 1455354920s"); ex.From.Should().Be(new DateTime(2016, 2, 13, 10, 15, 20, DateTimeKind.Local).ToUniversalTime()); ex.To.Should().Be(null); }
public void RelativeTo() { var ex = new TimeExpression("time < now() - 6h"); var shouldTime = DateTime.UtcNow - TimeSpan.FromHours(6); var diff = shouldTime - ex.To.Value; Math.Abs(diff.TotalMinutes).Should().BeLessThan(1); }