@@ -272,6 +272,19 @@ public void NestedComponentPropertyCastTest()
272
272
o => o ? . Name == "component[OtherProperty1]" ) ;
273
273
}
274
274
275
+ [ Test ( Description = "GH-2937" ) ]
276
+ public void CompositeUserTypePropertyTest ( )
277
+ {
278
+ var query = session . Query < Glarch > ( ) . Select ( o => o . Multiple . count ) ;
279
+ AssertSupported (
280
+ query ,
281
+ typeof ( Glarch ) . FullName ,
282
+ "Multiple.count" ,
283
+ o => o is Int32Type ,
284
+ o => o ? . Name == typeof ( MultiplicityType ) . FullName ,
285
+ null ) ;
286
+ }
287
+
275
288
[ Test ]
276
289
public void ManyToOneTest ( )
277
290
{
@@ -723,9 +736,10 @@ private void AssertSupported(
723
736
string expectedEntityName ,
724
737
string expectedMemberPath ,
725
738
Predicate < IType > expectedMemberType ,
726
- Predicate < IAbstractComponentType > expectedComponentType = null )
739
+ Predicate < IAbstractComponentType > expectedComponentType = null ,
740
+ bool ? nullability = true )
727
741
{
728
- AssertResult ( query , true , true , expectedEntityName , expectedMemberPath , expectedMemberType , expectedComponentType ) ;
742
+ AssertResult ( query , true , true , expectedEntityName , expectedMemberPath , expectedMemberType , expectedComponentType , nullability ) ;
729
743
}
730
744
731
745
private void AssertSupported (
@@ -768,7 +782,7 @@ private void AssertResult(
768
782
string expectedMemberPath ,
769
783
Predicate < IType > expectedMemberType ,
770
784
Predicate < IAbstractComponentType > expectedComponentType = null ,
771
- bool nullability = true )
785
+ bool ? nullability = true )
772
786
{
773
787
expectedComponentType = expectedComponentType ?? ( o => o == null ) ;
774
788
@@ -809,8 +823,12 @@ private void AssertResult(
809
823
810
824
if ( found )
811
825
{
812
- Assert . That ( _tryGetMappedNullability ( Sfi , queryModel . SelectClause . Selector , out var isNullable ) , Is . True , "Expression should be supported" ) ;
813
- Assert . That ( nullability , Is . EqualTo ( isNullable ) , "Nullability is not correct" ) ;
826
+ Assert . That (
827
+ _tryGetMappedNullability ( Sfi , queryModel . SelectClause . Selector , out var isNullable ) ,
828
+ Is . EqualTo ( nullability . HasValue ) ,
829
+ $ "Expression should be { ( nullability . HasValue ? "supported" : "unsupported" ) } ") ;
830
+ if ( nullability . HasValue )
831
+ Assert . That ( nullability , Is . EqualTo ( isNullable ) , "Nullability is not correct" ) ;
814
832
}
815
833
}
816
834
}
0 commit comments