File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
src/Mvc/Mvc.Core/test/ModelBinding/Metadata Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -211,8 +211,14 @@ public void GetMetadataForParameter_SuppliesEmptyAttributes_WhenParameterHasNoAt
211211 // Assert
212212 var defaultMetadata = Assert . IsType < DefaultModelMetadata > ( metadata ) ;
213213
214- // Not exactly "no attributes" due to SerializableAttribute on object.
215- Assert . IsType < SerializableAttribute > ( Assert . Single ( defaultMetadata . Attributes . Attributes ) ) ;
214+ // Not exactly "no attributes" due to pseudo-attributes on object.
215+ // After CoreCLR consistency fix, object.GetCustomAttributes() returns all pseudo-attributes.
216+ Assert . Equal ( 5 , defaultMetadata . Attributes . Attributes . Count ) ;
217+ Assert . Contains ( defaultMetadata . Attributes . Attributes , attr => attr is SerializableAttribute ) ;
218+ Assert . Contains ( defaultMetadata . Attributes . Attributes , attr => attr . GetType ( ) . Name == "NullableContextAttribute" ) ;
219+ Assert . Contains ( defaultMetadata . Attributes . Attributes , attr => attr . GetType ( ) . Name == "ClassInterfaceAttribute" ) ;
220+ Assert . Contains ( defaultMetadata . Attributes . Attributes , attr => attr . GetType ( ) . Name == "ComVisibleAttribute" ) ;
221+ Assert . Contains ( defaultMetadata . Attributes . Attributes , attr => attr . GetType ( ) . Name == "TypeForwardedFromAttribute" ) ;
216222 }
217223
218224 [ Fact ]
Original file line number Diff line number Diff line change @@ -185,8 +185,14 @@ public void GetAttributesForParameter_NoAttributes()
185185 . GetParameters ( ) [ 0 ] ) ;
186186
187187 // Assert
188- // Not exactly "no attributes" due to SerializableAttribute on object.
189- Assert . IsType < SerializableAttribute > ( Assert . Single ( attributes . Attributes ) ) ;
188+ // Not exactly "no attributes" due to pseudo-attributes on object.
189+ // After CoreCLR consistency fix, object.GetCustomAttributes() returns all pseudo-attributes.
190+ Assert . Equal ( 5 , attributes . Attributes . Count ) ;
191+ Assert . Contains ( attributes . Attributes , attr => attr is SerializableAttribute ) ;
192+ Assert . Contains ( attributes . Attributes , attr => attr . GetType ( ) . Name == "NullableContextAttribute" ) ;
193+ Assert . Contains ( attributes . Attributes , attr => attr . GetType ( ) . Name == "ClassInterfaceAttribute" ) ;
194+ Assert . Contains ( attributes . Attributes , attr => attr . GetType ( ) . Name == "ComVisibleAttribute" ) ;
195+ Assert . Contains ( attributes . Attributes , attr => attr . GetType ( ) . Name == "TypeForwardedFromAttribute" ) ;
190196 Assert . Empty ( attributes . ParameterAttributes ) ;
191197 Assert . Null ( attributes . PropertyAttributes ) ;
192198 Assert . Equal ( attributes . Attributes , attributes . TypeAttributes ) ;
You can’t perform that action at this time.
0 commit comments