public void Count_Distinct() { Person person = null; IFunction func = (IFunction)sql.Val(() => SqlExp.CountDistinct(person.Name)); QueryResult result = engine.Compile(func); Assert.Equal("COUNT(DISTINCT \"person\".\"Name\")", result.Sql); Assert.Equal(new Dictionary <string, object>(), result.Parameters); }
public void Count_Distinct() { engine.AddFunction(FunctionName.Concat, FunctionHelper.ConcatOr); Person person = new Person(); Exception ex = Assert.Throws <InvalidOperationException>(() => SqlExp.CountDistinct(person.Name)); Assert.Equal("Only for expressions.", ex.Message); }
public void Count_Distinct() { engine.AddFunction(FunctionName.Concat, FunctionHelper.ConcatOr); Person person = null; IFunction func = (IFunction)sql.Val(() => SqlExp.CountDistinct(person.Name)); QueryResult result = engine.Compile(func); Assert.Equal("COUNT(DISTINCT `person`.`Name`)", result.Sql); Assert.Equal(new Dictionary <string, object>(), result.Parameters); }