public void SingleCollectionAwkwardObjectWorks() { var funcFac = GenerateSingleAwkwardMapper(); var post1 = new PostWithoutCollectionInitializerInConstructor { PostWithoutCollectionInitializerInConstructorId = 1 }; var post2 = new PostWithoutCollectionInitializerInConstructor { PostWithoutCollectionInitializerInConstructorId = 2 }; var comment1 = new CommentTwo { CommentTwoId = 1 }; var comment2 = new CommentTwo { CommentTwoId = 2 }; var comment3 = new CommentTwo { CommentTwoId = 3 }; PostWithoutCollectionInitializerInConstructor currentRoot = null; IList <PostWithoutCollectionInitializerInConstructor> results = new List <PostWithoutCollectionInitializerInConstructor>(); var func = (Func <object[], PostWithoutCollectionInitializerInConstructor>)funcFac.DynamicInvoke(currentRoot, results); func(new object[] { post1, comment1 }); func(new object[] { post1, comment2 }); func(new object[] { post2, comment3 }); Assert.Equal(1, results[0].Comments.First().CommentTwoId); Assert.Equal(2, results[0].Comments.Last().CommentTwoId); Assert.Equal(3, results[1].Comments.First().CommentTwoId); }
public void SingleCollectionAwkwardObjectWorks() { var funcFac = GenerateSingleAwkwardMapper(); var post1 = new PostWithoutCollectionInitializerInConstructor { PostWithoutCollectionInitializerInConstructorId = 1 }; var post2 = new PostWithoutCollectionInitializerInConstructor { PostWithoutCollectionInitializerInConstructorId = 2 }; var comment1 = new CommentTwo { CommentTwoId = 1 }; var comment2 = new CommentTwo { CommentTwoId = 2 }; var comment3 = new CommentTwo { CommentTwoId = 3 }; PostWithoutCollectionInitializerInConstructor currentRoot = null; IList<PostWithoutCollectionInitializerInConstructor> results = new List<PostWithoutCollectionInitializerInConstructor>(); var func = (Func<object[], PostWithoutCollectionInitializerInConstructor>)funcFac.DynamicInvoke(currentRoot, results); func(new object[] { post1, comment1 }); func(new object[] { post1, comment2 }); func(new object[] { post2, comment3 }); Assert.Equal(1, results[0].Comments.First().CommentTwoId); Assert.Equal(2, results[0].Comments.Last().CommentTwoId); Assert.Equal(3, results[1].Comments.First().CommentTwoId); }