public void Expression_Method_Invalid_Call() { Person person = new Person(); Exception ex = Assert.Throws <InvalidOperationException>(() => SqlExp.Gt(person.Id, 1)); Assert.Equal("Only for expressions.", ex.Message); }
public void Expression_Method_Null() { Person person = null; IOperator op = sql.Op(() => SqlExp.Gt(person.Name, null)); QueryResult result = engine.Compile(op); Assert.Equal("\"person\".\"Name\" > NULL", result.Sql); Assert.Equal(new Dictionary <string, object>(), result.Parameters); }
public void Expression_Method_Enumerable() { Person person = null; IOperator op = sql.Op(() => SqlExp.Gt(person.Image, new byte[] { 1, 2, 3 })); QueryResult result = engine.Compile(op); Assert.Equal("\"person\".\"Image\" > @p0", result.Sql); Assert.Equal(new Dictionary <string, object> { ["@p0"] = new byte[] { 1, 2, 3 } }, result.Parameters); }
public void Expression_Method() { Person person = null; IOperator op = sql.Op(() => SqlExp.Gt(person.Id, 1)); QueryResult result = engine.Compile(op); Assert.Equal("\"person\".\"Id\" > @p0", result.Sql); Assert.Equal(new Dictionary <string, object> { ["@p0"] = 1 }, result.Parameters); }