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