public void TestCountDistinct() { DetachedCriteria expected = DetachedCriteria.For <Person>() .SetProjection(Projections.CountDistinct("Name")); DetachedCriteria actual = DetachedCriteria.For <Person>() .SetProjection(LambdaProjection.CountDistinct <Person>(p => p.Name)); AssertCriteriaAreEqual(expected, actual); }
public void TestCountDistinctUsingAlias() { DetachedCriteria expected = DetachedCriteria.For <Person>("personAlias") .SetProjection(Projections.CountDistinct("personAlias.Age")); Person personAlias = null; DetachedCriteria actual = DetachedCriteria <Person> .Create(() => personAlias) .SetProjection(LambdaProjection.CountDistinct(() => personAlias.Age)); AssertCriteriaAreEqual(expected, actual); }