public void Coalesce_Object_Overload() { Person person = new Person(); Exception ex = Assert.Throws <InvalidOperationException>(() => SqlExp.Coalesce(person.Name, person.Salary)); Assert.Equal("Only for expressions.", ex.Message); }
public void Coalesce() { Person person = null; IFunction func = (IFunction)sql.Val(() => SqlExp.Coalesce(person.Name, person.SurName)); QueryResult result = engine.Compile(func); Assert.Equal("COALESCE(`person`.`Name`, `person`.`SurName`)", result.Sql); Assert.Equal(new Dictionary <string, object>(), result.Parameters); }
public void Coalesce_Object_Overload() { Person person = null; IFunction func = (IFunction)sql.Val(() => SqlExp.Coalesce(person.Name, person.Salary)); QueryResult result = engine.Compile(func); Assert.Equal("COALESCE(\"person\".\"Name\", \"person\".\"Salary\")", result.Sql); Assert.Equal(new Dictionary <string, object>(), result.Parameters); }