public void Replace() { Person person = new Person(); Exception ex = Assert.Throws <InvalidOperationException>(() => SqlExp.Replace(person.Name, "a", "b")); Assert.Equal("Only for expressions.", ex.Message); }
public void Replace() { Person person = null; IFunction func = (IFunction)sql.Val(() => SqlExp.Replace(person.Name, "a", "b")); QueryResult result = engine.Compile(func); Assert.Equal("REPLACE(`person`.`Name`, @p0, @p1)", result.Sql); Assert.Equal(new Dictionary <string, object>() { ["@p0"] = "a", ["@p1"] = "b" }, result.Parameters); }