예제 #1
0
        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);
        }
예제 #2
0
        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);
        }