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