public void Cast() { Person person = new Person(); Exception ex = Assert.Throws <InvalidOperationException>(() => SqlExp.Cast(person.Salary, sql.Type("VARCHAR"))); Assert.Equal("Only for expressions.", ex.Message); }
public void Cast() { Person person = null; IFunction func = (IFunction)sql.Val(() => SqlExp.Cast(person.Salary, sql.Type("VARCHAR"))); QueryResult result = engine.Compile(func); Assert.Equal("CAST(`person`.`Salary` AS VARCHAR)", result.Sql); Assert.Equal(new Dictionary <string, object>(), result.Parameters); }