@@ -316,6 +316,83 @@ public void ProjectKnownTypeWithCollection2()
316
316
Assert . That ( result [ 0 ] . ExpandedElement . OrderLines , Is . EquivalentTo ( result [ 0 ] . ProjectedProperty0 ) ) ;
317
317
}
318
318
319
+ [ Test ]
320
+ public void ProjectNestedKnownTypeWithCollection ( )
321
+ {
322
+
323
+ var query = from o in db . Products
324
+ select new ExpandedWrapper < Product , ExpandedWrapper < Supplier , IEnumerable < Product > > >
325
+ {
326
+ ExpandedElement = o ,
327
+ ProjectedProperty0 = new ExpandedWrapper < Supplier , IEnumerable < Product > > ( )
328
+ {
329
+ ExpandedElement = o . Supplier ,
330
+ ProjectedProperty0 = o . Supplier . Products ,
331
+ Description = "Products" ,
332
+ ReferenceDescription = ""
333
+ } ,
334
+ Description = "Supplier" ,
335
+ ReferenceDescription = "Supplier"
336
+ } ;
337
+
338
+ var result = query . ToList ( ) ;
339
+ Assert . That ( result . Count , Is . EqualTo ( 77 ) ) ;
340
+ Assert . That ( result [ 0 ] . ExpandedElement . Supplier , Is . EqualTo ( result [ 0 ] . ProjectedProperty0 . ExpandedElement ) ) ;
341
+ Assert . That ( result [ 0 ] . ExpandedElement . Supplier . Products , Is . EquivalentTo ( result [ 0 ] . ProjectedProperty0 . ProjectedProperty0 ) ) ;
342
+
343
+ }
344
+
345
+ [ Test ]
346
+ public void ProjectNestedAnonymousTypeWithCollection ( )
347
+ {
348
+
349
+ var query = from o in db . Products
350
+ select new
351
+ {
352
+ ExpandedElement = o ,
353
+ ProjectedProperty0 = new
354
+ {
355
+ ExpandedElement = o . Supplier ,
356
+ ProjectedProperty0 = o . Supplier . Products ,
357
+ Description = "Products" ,
358
+ ReferenceDescription = ""
359
+ } ,
360
+ Description = "Supplier" ,
361
+ ReferenceDescription = "Supplier"
362
+ } ;
363
+
364
+ var result = query . ToList ( ) ;
365
+ Assert . That ( result . Count , Is . EqualTo ( 77 ) ) ;
366
+ Assert . That ( result [ 0 ] . ExpandedElement . Supplier , Is . EqualTo ( result [ 0 ] . ProjectedProperty0 . ExpandedElement ) ) ;
367
+ Assert . That ( result [ 0 ] . ExpandedElement . Supplier . Products , Is . EquivalentTo ( result [ 0 ] . ProjectedProperty0 . ProjectedProperty0 ) ) ;
368
+
369
+ }
370
+
371
+ [ Test ]
372
+ public void ProjectNestedAnonymousTypeWithProjectedCollection ( )
373
+ {
374
+
375
+ var query = from o in db . Products
376
+ select new
377
+ {
378
+ ExpandedElement = o ,
379
+ ProjectedProperty0 = new
380
+ {
381
+ ExpandedElement = o . Supplier ,
382
+ ProjectedProperty0 = o . Supplier . Products . Select ( x=> new { x . Name } ) ,
383
+ Description = "Products" ,
384
+ ReferenceDescription = ""
385
+ } ,
386
+ Description = "Supplier" ,
387
+ ReferenceDescription = "Supplier"
388
+ } ;
389
+
390
+ var result = query . ToList ( ) ;
391
+ Assert . That ( result . Count , Is . EqualTo ( 77 ) ) ;
392
+ Assert . That ( result . Single ( x => x . ExpandedElement . ProductId == 1 ) . ProjectedProperty0 . ProjectedProperty0 . Count ( ) , Is . EqualTo ( 3 ) ) ;
393
+
394
+ }
395
+
319
396
[ Test ]
320
397
public void CanProjectComplexDictionaryIndexer ( )
321
398
{
0 commit comments