Skip to content

Commit bcfa508

Browse files
authored
Fix attribute order dependency in ModelAttributesTest (#62909)
1 parent bf1f642 commit bcfa508

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Mvc/Mvc.Core/test/ModelBinding/Metadata/ModelAttributesTest.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,8 @@ public void GetAttributesForParameter_SomeAttributes()
216216
attribute => Assert.IsType<RequiredAttribute>(attribute),
217217
attribute => Assert.IsType<RangeAttribute>(attribute));
218218
Assert.Null(attributes.PropertyAttributes);
219-
Assert.Collection(
220-
// Take(1) because the attribute or attributes after SerializableAttribute are framework-specific.
221-
attributes.TypeAttributes.Take(1),
222-
attribute => Assert.IsType<SerializableAttribute>(attribute));
219+
// Check that SerializableAttribute exists in TypeAttributes (order-agnostic)
220+
Assert.Contains(attributes.TypeAttributes, attr => attr is SerializableAttribute);
223221
}
224222

225223
[Fact]

0 commit comments

Comments
 (0)