예제 #1
0
        public void TestPropertyAliasWithValueType()
        {
            DetachedCriteria expected =
                DetachedCriteria.For <Person>()
                .SetProjection(Projections.Alias(Projections.Property("Age"), "ageAlias"));

            int ageAlias            = 0;
            DetachedCriteria actual =
                DetachedCriteria.For <Person>()
                .SetProjection(LambdaProjection.Alias(LambdaProjection.Property <Person>(p => p.Age), () => ageAlias));

            AssertCriteriaAreEqual(expected, actual);
        }
예제 #2
0
        public void Test_PropertyUsingAlias()
        {
            DetachedCriteria expected =
                DetachedCriteria.For <Person>()
                .SetProjection(Projections.Alias(Projections.Property("Name"), "nameAlias"));

            string           nameAlias = null;
            DetachedCriteria actual    =
                DetachedCriteria.For <Person>()
                .SetProjection(LambdaProjection.Alias(LambdaProjection.Property <Person>(p => p.Name), () => nameAlias));

            AssertCriteriaAreEqual(expected, actual);
        }