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
211
211
// Assert
212
212
var defaultMetadata = Assert . IsType < DefaultModelMetadata > ( metadata ) ;
213
213
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 ) ;
216
222
}
217
223
218
224
[ Fact ]
Original file line number Diff line number Diff line change @@ -185,11 +185,15 @@ public void GetAttributesForParameter_NoAttributes()
185
185
. GetParameters ( ) [ 0 ] ) ;
186
186
187
187
// 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
190
189
Assert . Empty ( attributes . ParameterAttributes ) ;
191
190
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 ) ;
193
197
}
194
198
195
199
[ Fact ]
You can’t perform that action at this time.
0 commit comments