public void ShouldNotAddTimeRangeConstraintForEmptyRequest() { var req = new NameValueCollection(); var builder = new ConstraintsBuilder(req); builder.MaybeAddTimeRangeConstraint("test"); Assert.AreEqual(0, builder.ToList().Count); }
public void ShouldAddTimeRangeConstraintWhenBothStartAndEndArePresent() { var req = new NameValueCollection(); req["createTime-start"] = "2011-06-06T12:00:00.000Z"; req["createTime-end"] = "2011-06-06T16:00:00.000Z"; var builder = new ConstraintsBuilder(req); builder.MaybeAddTimeRangeConstraint("createTime"); Assert.AreEqual(1, builder.ToList().Count); Assert.IsInstanceOf(typeof(DateRangeQueryConstraint), builder.ToList()[0]); var c = (DateRangeQueryConstraint)builder.ToList()[0]; Assert.AreEqual(new DateTime(2011, 6, 6, 12, 0, 0, 0, DateTimeKind.Utc), c.LowerBound); Assert.AreEqual(new DateTime(2011, 6, 6, 16, 0, 0, 0, DateTimeKind.Utc), c.UpperBound); }
public void ShouldAddTimeRangeConstraintWhenBothStartAndEndArePresent() { var req = new NameValueCollection(); req["createTime-start"] = "2011-06-06T12:00:00.000Z"; req["createTime-end"] = "2011-06-06T16:00:00.000Z"; var builder = new ConstraintsBuilder(req); builder.MaybeAddTimeRangeConstraint("createTime"); Assert.AreEqual(1, builder.ToList().Count); Assert.IsInstanceOf(typeof (DateRangeQueryConstraint), builder.ToList()[0]); var c = (DateRangeQueryConstraint) builder.ToList()[0]; Assert.AreEqual(new DateTime(2011, 6, 6, 12, 0, 0, 0, DateTimeKind.Utc), c.LowerBound); Assert.AreEqual(new DateTime(2011, 6, 6, 16, 0, 0, 0, DateTimeKind.Utc), c.UpperBound); }
public void ShouldNotAddTimeRangeConstraintForEmptyRequest() { var req = new NameValueCollection(); var builder = new ConstraintsBuilder(req); builder.MaybeAddTimeRangeConstraint("test"); Assert.AreEqual(0, builder.ToList().Count); }