@@ -549,6 +549,55 @@ public void GroupByComputedValueInObjectArray()
549
549
Assert . AreEqual ( 830 , orderGroups . Sum ( g => g . Count ) ) ;
550
550
}
551
551
552
+ [ Test ( Description = "NH-3801" ) ]
553
+ public void GroupByComputedValueWithJoinOnObject ( )
554
+ {
555
+ var orderGroups = db . OrderLines . GroupBy ( o => o . Order . Customer == null ? 0 : 1 ) . Select ( g => new { Key = g . Key , Count = g . Count ( ) } ) . ToList ( ) ;
556
+ Assert . AreEqual ( 2155 , orderGroups . Sum ( g => g . Count ) ) ;
557
+ }
558
+
559
+ [ Test ( Description = "NH-3801" ) ]
560
+ public void GroupByComputedValueWithJoinOnId ( )
561
+ {
562
+ var orderGroups = db . OrderLines . GroupBy ( o => o . Order . Customer . CustomerId == null ? 0 : 1 ) . Select ( g => new { Key = g . Key , Count = g . Count ( ) } ) . ToList ( ) ;
563
+ Assert . AreEqual ( 2155 , orderGroups . Sum ( g => g . Count ) ) ;
564
+ }
565
+
566
+ [ Test ( Description = "NH-3801" ) ]
567
+ public void GroupByComputedValueInAnonymousTypeWithJoinOnObject ( )
568
+ {
569
+ var orderGroups = db . OrderLines . GroupBy ( o => new { Key = o . Order . Customer == null ? 0 : 1 } ) . Select ( g => new { Key = g . Key , Count = g . Count ( ) } ) . ToList ( ) ;
570
+ Assert . AreEqual ( 2155 , orderGroups . Sum ( g => g . Count ) ) ;
571
+ }
572
+
573
+ [ Test ( Description = "NH-3801" ) ]
574
+ public void GroupByComputedValueInAnonymousTypeWithJoinOnId ( )
575
+ {
576
+ var orderGroups = db . OrderLines . GroupBy ( o => new { Key = o . Order . Customer . CustomerId == null ? 0 : 1 } ) . Select ( g => new { Key = g . Key , Count = g . Count ( ) } ) . ToList ( ) ;
577
+ Assert . AreEqual ( 2155 , orderGroups . Sum ( g => g . Count ) ) ;
578
+ }
579
+
580
+ [ Test ( Description = "NH-3801" ) ]
581
+ public void GroupByComputedValueInObjectArrayWithJoinOnObject ( )
582
+ {
583
+ var orderGroups = db . OrderLines . GroupBy ( o => new [ ] { o . Order . Customer == null ? 0 : 1 } ) . Select ( g => new { Key = g . Key , Count = g . Count ( ) } ) . ToList ( ) ;
584
+ Assert . AreEqual ( 2155 , orderGroups . Sum ( g => g . Count ) ) ;
585
+ }
586
+
587
+ [ Test ( Description = "NH-3801" ) ]
588
+ public void GroupByComputedValueInObjectArrayWithJoinOnId ( )
589
+ {
590
+ var orderGroups = db . OrderLines . GroupBy ( o => new [ ] { o . Order . Customer . CustomerId == null ? 0 : 1 } ) . Select ( g => new { Key = g . Key , Count = g . Count ( ) } ) . ToList ( ) ;
591
+ Assert . AreEqual ( 2155 , orderGroups . Sum ( g => g . Count ) ) ;
592
+ }
593
+
594
+ [ Test ( Description = "NH-3801" ) ]
595
+ public void GroupByComputedValueInObjectArrayWithJoinInRightSideOfCase ( )
596
+ {
597
+ var orderGroups = db . OrderLines . GroupBy ( o => new [ ] { o . Order . Customer . CustomerId == null ? "unknown" : o . Order . Customer . CompanyName } ) . Select ( g => new { Key = g . Key , Count = g . Count ( ) } ) . ToList ( ) ;
598
+ Assert . AreEqual ( 2155 , orderGroups . Sum ( g => g . Count ) ) ;
599
+ }
600
+
552
601
private static void CheckGrouping < TKey , TElement > ( IEnumerable < IGrouping < TKey , TElement > > groupedItems , Func < TElement , TKey > groupBy )
553
602
{
554
603
var used = new HashSet < object > ( ) ;
0 commit comments