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