File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
src/Mvc/Mvc.Core/test/ModelBinding/Metadata Expand file tree Collapse file tree 2 files changed +15
-5
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+ // The parameter itself has no attributes
215+ Assert . Empty ( defaultMetadata . Attributes . ParameterAttributes ) ;
216+
217+ // Type attributes exist (but we don't care what they are - that's runtime implementation detail)
218+ Assert . NotEmpty ( defaultMetadata . Attributes . TypeAttributes ) ;
219+
220+ // Combined attributes = ParameterAttributes + TypeAttributes (when parameter has no attributes)
221+ Assert . Equal ( defaultMetadata . Attributes . TypeAttributes , defaultMetadata . Attributes . Attributes ) ;
216222 }
217223
218224 [ Fact ]
Original file line number Diff line number Diff line change @@ -185,11 +185,15 @@ 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+ // The parameter itself has no attributes
190189 Assert . Empty ( attributes . ParameterAttributes ) ;
191190 Assert . Null ( attributes . PropertyAttributes ) ;
192- Assert . Equal ( attributes . Attributes , attributes . TypeAttributes ) ;
191+
192+ // Type attributes exist (but we don't care what they are - that's runtime implementation detail)
193+ Assert . NotEmpty ( attributes . TypeAttributes ) ;
194+
195+ // Combined attributes = ParameterAttributes + TypeAttributes (when parameter has no attributes)
196+ Assert . Equal ( attributes . TypeAttributes , attributes . Attributes ) ;
193197 }
194198
195199 [ Fact ]
You can’t perform that action at this time.
0 commit comments