Esempio n. 1
0
        public void OrderByListByNameTest()
        {
            MemberAssignment[] assignments = new MemberAssignment[]
            {
                sourceParam.BindOrderedList <ObjectE, ObjectA, int, ObjectB>("ListOfB", "ListOfA", "Id", ObjectB.FromObjectA)
            };

            ObjectE obj = listOfObjectD.Select(Expression.Lambda <Func <ObjectD, ObjectE> >(
                                                   Expression.MemberInit(Expression.New(typeof(ObjectE)), assignments)
                                                   , sourceParam).Compile()).FirstOrDefault();

            Assert.IsNotNull(obj.ListOfB);
            Assert.AreEqual(1, obj.ListOfB.FirstOrDefault().Id);
            Assert.AreEqual(9, obj.ListOfB.LastOrDefault().Id);
        }