public void Test_Count() { DetachedCriteria expected = DetachedCriteria.For <Person>() .SetProjection(Projections.Count("Age")); DetachedCriteria actual = DetachedCriteria.For <Person>() .SetProjection(LambdaProjection.Count <Person>(p => p.Age)); AssertCriteriaAreEqual(expected, actual); }
public void TestCountUsingAlias() { DetachedCriteria expected = DetachedCriteria.For <Person>("personAlias") .SetProjection(Projections.Count("personAlias.Age")); Person personAlias = null; DetachedCriteria actual = DetachedCriteria <Person> .Create(() => personAlias) .SetProjection(LambdaProjection.Count(() => personAlias.Age)); AssertCriteriaAreEqual(expected, actual); }