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); }
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); }