@@ -7753,6 +7753,157 @@ public virtual Task Project_entity_and_collection_element(bool isAsync)
7753
7753
} ) ;
7754
7754
}
7755
7755
7756
+ [ ConditionalTheory ]
7757
+ [ MemberData ( nameof ( IsAsyncData ) ) ]
7758
+ public virtual Task Complex_GroupBy_after_set_operator ( bool isAsync )
7759
+ {
7760
+ return AssertQuery (
7761
+ isAsync ,
7762
+ ss => ( from g in ss . Set < Gear > ( )
7763
+ select new
7764
+ {
7765
+ g . AssignedCity . Name ,
7766
+ Count = g . Weapons . Count ( ) ,
7767
+ } ) . Concat (
7768
+ from g in ss . Set < Gear > ( )
7769
+ select new
7770
+ {
7771
+ g . CityOfBirth . Name ,
7772
+ Count = g . Weapons . Count ( ) ,
7773
+ } )
7774
+ . GroupBy ( x => new { x . Name , x . Count } )
7775
+ . Select ( g => new { g . Key . Name , g . Key . Count , Sum = g . Sum ( xx => xx . Count ) } ) ,
7776
+ ss => ( from g in ss . Set < Gear > ( )
7777
+ select new
7778
+ {
7779
+ Name = Maybe ( g . AssignedCity , ( ) => g . AssignedCity . Name ) ,
7780
+ Count = g . Weapons . Count ( ) ,
7781
+ } ) . Concat (
7782
+ from g in ss . Set < Gear > ( )
7783
+ select new
7784
+ {
7785
+ g . CityOfBirth . Name ,
7786
+ Count = g . Weapons . Count ( ) ,
7787
+ } )
7788
+ . GroupBy ( x => new { x . Name , x . Count } )
7789
+ . Select ( g => new { g . Key . Name , g . Key . Count , Sum = g . Sum ( xx => xx . Count ) } ) ,
7790
+ elementSorter : e => ( e . Name , e . Count , e . Sum ) ) ;
7791
+ }
7792
+
7793
+ [ ConditionalTheory ( Skip = "issue #18267" ) ]
7794
+ [ MemberData ( nameof ( IsAsyncData ) ) ]
7795
+ public virtual Task Complex_GroupBy_after_set_operator_using_result_selector ( bool isAsync )
7796
+ {
7797
+ return AssertQuery (
7798
+ isAsync ,
7799
+ ss => ( from g in ss . Set < Gear > ( )
7800
+ select new
7801
+ {
7802
+ g . AssignedCity . Name ,
7803
+ Count = g . Weapons . Count ( ) ,
7804
+ } ) . Concat (
7805
+ from g in ss . Set < Gear > ( )
7806
+ select new
7807
+ {
7808
+ g . CityOfBirth . Name ,
7809
+ Count = g . Weapons . Count ( ) ,
7810
+ } )
7811
+ . GroupBy (
7812
+ x => new { x . Name , x . Count } ,
7813
+ ( k , g ) => new { k . Name , k . Count , Sum = g . Sum ( xx => xx . Count ) } ) ,
7814
+ ss => ( from g in ss . Set < Gear > ( )
7815
+ select new
7816
+ {
7817
+ Name = Maybe ( g . AssignedCity , ( ) => g . AssignedCity . Name ) ,
7818
+ Count = g . Weapons . Count ( ) ,
7819
+ } ) . Concat (
7820
+ from g in ss . Set < Gear > ( )
7821
+ select new
7822
+ {
7823
+ g . CityOfBirth . Name ,
7824
+ Count = g . Weapons . Count ( ) ,
7825
+ } )
7826
+ . GroupBy (
7827
+ x => new { x . Name , x . Count } ,
7828
+ ( k , g ) => new { k . Name , k . Count , Sum = g . Sum ( xx => xx . Count ) } ) ,
7829
+ elementSorter : e => ( e . Name , e . Count , e . Sum ) ) ;
7830
+ }
7831
+
7832
+ [ ConditionalTheory ]
7833
+ [ MemberData ( nameof ( IsAsyncData ) ) ]
7834
+ public virtual Task Left_join_with_GroupBy_with_composite_group_key ( bool isAsync )
7835
+ {
7836
+ return AssertQuery (
7837
+ isAsync ,
7838
+ ss => from g in ss . Set < Gear > ( )
7839
+ join s in ss . Set < Squad > ( ) on g . SquadId equals s . Id
7840
+ join t in ss . Set < CogTag > ( ) on g . Nickname equals t . GearNickName into grouping
7841
+ from t in grouping . DefaultIfEmpty ( )
7842
+ group g by new { g . CityOrBirthName , g . HasSoulPatch } into groupby
7843
+ select new { groupby . Key . CityOrBirthName , groupby . Key . HasSoulPatch } ,
7844
+ elementSorter : e => ( e . CityOrBirthName , e . HasSoulPatch ) ) ;
7845
+ }
7846
+
7847
+ [ ConditionalTheory ]
7848
+ [ MemberData ( nameof ( IsAsyncData ) ) ]
7849
+ public virtual Task GroupBy_with_boolean_grouping_key ( bool isAsync )
7850
+ {
7851
+ return AssertQuery (
7852
+ isAsync ,
7853
+ ss => ss . Set < Gear > ( )
7854
+ . Select ( g => new { g . Nickname , g . CityOrBirthName , g . HasSoulPatch , IsMarcus = g . Nickname == "Marcus" } )
7855
+ . GroupBy ( g => new { g . CityOrBirthName , g . HasSoulPatch , g . IsMarcus } )
7856
+ . Select ( x => new { x . Key . CityOrBirthName , x . Key . HasSoulPatch , x . Key . IsMarcus , Count = x . Count ( ) } ) ,
7857
+ elementSorter : e => ( e . CityOrBirthName , e . HasSoulPatch , e . IsMarcus , e . Count ) ) ;
7858
+ }
7859
+
7860
+ [ ConditionalTheory ]
7861
+ [ MemberData ( nameof ( IsAsyncData ) ) ]
7862
+ public virtual Task GroupBy_with_boolean_groupin_key_thru_navigation_access ( bool isAsync )
7863
+ {
7864
+ return AssertQuery (
7865
+ isAsync ,
7866
+ ss => ss . Set < CogTag > ( )
7867
+ . GroupBy ( t => new { t . Gear . HasSoulPatch , t . Gear . Squad . Name } )
7868
+ . Select ( g => new { g . Key . HasSoulPatch , Name = g . Key . Name . ToLower ( ) } ) ,
7869
+ ss => ss . Set < CogTag > ( )
7870
+ . GroupBy ( t => new
7871
+ {
7872
+ HasSoulPatch = MaybeScalar < bool > ( t . Gear , ( ) => t . Gear . HasSoulPatch ) ?? false ,
7873
+ Name = Maybe ( t . Gear , ( ) => t . Gear . Squad . Name )
7874
+ } )
7875
+ . Select ( g => new { g . Key . HasSoulPatch , Name = Maybe ( g . Key . Name , ( ) => g . Key . Name . ToLower ( ) ) } ) ,
7876
+ elementSorter : e => ( e . HasSoulPatch , e . Name ) ) ;
7877
+ }
7878
+
7879
+ [ ConditionalTheory ]
7880
+ [ MemberData ( nameof ( IsAsyncData ) ) ]
7881
+ public virtual Task Group_by_over_projection_with_multiple_properties_accessed_thru_navigation ( bool isAsync )
7882
+ {
7883
+ return AssertQuery (
7884
+ isAsync ,
7885
+ ss => ss . Set < Gear > ( )
7886
+ . Select ( g => new
7887
+ {
7888
+ g . Nickname ,
7889
+ AssignedCityName = g . AssignedCity . Name ,
7890
+ CityOfBirthName = g . CityOfBirth . Name ,
7891
+ SquadName = g . Squad . Name
7892
+ } )
7893
+ . GroupBy ( x => x . CityOfBirthName )
7894
+ . Select ( g => g . Key ) ,
7895
+ ss => ss . Set < Gear > ( )
7896
+ . Select ( g => new
7897
+ {
7898
+ g . Nickname ,
7899
+ AssignedCityName = Maybe ( g . AssignedCity , ( ) => g . AssignedCity . Name ) ,
7900
+ CityOfBirthName = Maybe ( g . CityOfBirth , ( ) => g . CityOfBirth . Name ) ,
7901
+ SquadName = g . Squad . Name
7902
+ } )
7903
+ . GroupBy ( x => x . CityOfBirthName )
7904
+ . Select ( g => g . Key ) ) ;
7905
+ }
7906
+
7756
7907
protected GearsOfWarContext CreateContext ( ) => Fixture . CreateContext ( ) ;
7757
7908
7758
7909
protected virtual void ClearLog ( )
0 commit comments