public void arguments_should_match() { _filter = new DateTimeEntityFilter(_fakeClock, _property, "2015.07.20"); var args = new List <object>(); _filter.GetSqlCondition("t0", ref args); Assert.Equal(2, args.Count); Assert.Equal("2015.07.20 00:00", args[0]); Assert.Equal("2015.07.20 23:59", args[1]); _filter = new DateTimeEntityFilter(_fakeClock, _property, "2015.07.13-2015.07.20"); args = new List <object>(); _filter.GetSqlCondition("t0", ref args); Assert.Equal(2, args.Count); Assert.Equal("2015.07.13 00:00", args[0]); Assert.Equal("2015.07.20 23:59", args[1]); _filter = new DateTimeEntityFilter(_fakeClock, _property, "-2015.07.20"); args = new List <object>(); _filter.GetSqlCondition("t0", ref args); Assert.Equal(1, args.Count); Assert.Equal("2015.07.20 23:59", args[0]); _filter = new DateTimeEntityFilter(_fakeClock, _property, "2015.07.13-"); args = new List <object>(); _filter.GetSqlCondition("t0", ref args); Assert.Equal(1, args.Count); Assert.Equal("2015.07.13 00:00", args[0]); }
public void sql_condition_should_match() { _filter = new DateTimeEntityFilter(_fakeClock, _property, "2015.07.20"); var args = new List<object>(); var sql = _filter.GetSqlCondition("t0", ref args); Assert.Equal("(t0[DateAdd] >= @0 AND t0[DateAdd] <= @1)", sql); _filter = new DateTimeEntityFilter(_fakeClock, _property, "2015.07.13-2015.07.20"); args = new List<object>(); sql = _filter.GetSqlCondition("t0", ref args); Assert.Equal("(t0[DateAdd] >= @0 AND t0[DateAdd] <= @1)", sql); _filter = new DateTimeEntityFilter(_fakeClock, _property, "-2015.07.20"); args = new List<object>(); sql = _filter.GetSqlCondition("t0", ref args); Assert.Equal("t0[DateAdd] <= @0", sql); _filter = new DateTimeEntityFilter(_fakeClock, _property, "2015.07.13-"); args = new List<object>(); sql = _filter.GetSqlCondition("t0", ref args); Assert.Equal("t0[DateAdd] >= @0", sql); }
public void sql_condition_should_match() { _filter = new DateTimeEntityFilter(_fakeClock, _property, "2015.07.20"); var args = new List <object>(); var sql = _filter.GetSqlCondition("t0", ref args); Assert.Equal("(t0[DateAdd] >= @0 AND t0[DateAdd] <= @1)", sql); _filter = new DateTimeEntityFilter(_fakeClock, _property, "2015.07.13-2015.07.20"); args = new List <object>(); sql = _filter.GetSqlCondition("t0", ref args); Assert.Equal("(t0[DateAdd] >= @0 AND t0[DateAdd] <= @1)", sql); _filter = new DateTimeEntityFilter(_fakeClock, _property, "-2015.07.20"); args = new List <object>(); sql = _filter.GetSqlCondition("t0", ref args); Assert.Equal("t0[DateAdd] <= @0", sql); _filter = new DateTimeEntityFilter(_fakeClock, _property, "2015.07.13-"); args = new List <object>(); sql = _filter.GetSqlCondition("t0", ref args); Assert.Equal("t0[DateAdd] >= @0", sql); }
public void arguments_should_match() { _filter = new DateTimeEntityFilter(_fakeClock, _property, "2015.07.20"); var args = new List<object>(); _filter.GetSqlCondition("t0", ref args); Assert.Equal(2, args.Count); Assert.Equal("2015.07.20 00:00", args[0]); Assert.Equal("2015.07.20 23:59", args[1]); _filter = new DateTimeEntityFilter(_fakeClock, _property, "2015.07.13-2015.07.20"); args = new List<object>(); _filter.GetSqlCondition("t0", ref args); Assert.Equal(2, args.Count); Assert.Equal("2015.07.13 00:00", args[0]); Assert.Equal("2015.07.20 23:59", args[1]); _filter = new DateTimeEntityFilter(_fakeClock, _property, "-2015.07.20"); args = new List<object>(); _filter.GetSqlCondition("t0", ref args); Assert.Equal(1, args.Count); Assert.Equal("2015.07.20 23:59", args[0]); _filter = new DateTimeEntityFilter(_fakeClock, _property, "2015.07.13-"); args = new List<object>(); _filter.GetSqlCondition("t0", ref args); Assert.Equal(1, args.Count); Assert.Equal("2015.07.13 00:00", args[0]); }