Example #1
0
        public void Test_Avg()
        {
            DetachedCriteria expected =
                DetachedCriteria.For <Person>()
                .SetProjection(Projections.Avg("Age"));

            DetachedCriteria actual =
                DetachedCriteria.For <Person>()
                .SetProjection(LambdaProjection.Avg <Person>(p => p.Age));

            AssertCriteriaAreEqual(expected, actual);
        }
Example #2
0
        public void TestAvgUsingAlias()
        {
            DetachedCriteria expected =
                DetachedCriteria.For <Person>("personAlias")
                .SetProjection(Projections.Avg("personAlias.Age"));

            Person           personAlias = null;
            DetachedCriteria actual      =
                DetachedCriteria <Person> .Create(() => personAlias)
                .SetProjection(LambdaProjection.Avg(() => personAlias.Age));

            AssertCriteriaAreEqual(expected, actual);
        }