Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,14 @@ public void GetMetadataForParameter_SuppliesEmptyAttributes_WhenParameterHasNoAt
// Assert
var defaultMetadata = Assert.IsType<DefaultModelMetadata>(metadata);

// Not exactly "no attributes" due to SerializableAttribute on object.
Assert.IsType<SerializableAttribute>(Assert.Single(defaultMetadata.Attributes.Attributes));
// The parameter itself has no attributes
Assert.Empty(defaultMetadata.Attributes.ParameterAttributes);

// Type attributes exist (but we don't care what they are - that's runtime implementation detail)
Assert.NotEmpty(defaultMetadata.Attributes.TypeAttributes);

// Combined attributes = ParameterAttributes + TypeAttributes (when parameter has no attributes)
Assert.Equal(defaultMetadata.Attributes.TypeAttributes, defaultMetadata.Attributes.Attributes);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,15 @@ public void GetAttributesForParameter_NoAttributes()
.GetParameters()[0]);

// Assert
// Not exactly "no attributes" due to SerializableAttribute on object.
Assert.IsType<SerializableAttribute>(Assert.Single(attributes.Attributes));
// The parameter itself has no attributes
Assert.Empty(attributes.ParameterAttributes);
Assert.Null(attributes.PropertyAttributes);
Assert.Equal(attributes.Attributes, attributes.TypeAttributes);

// Type attributes exist (but we don't care what they are - that's runtime implementation detail)
Assert.NotEmpty(attributes.TypeAttributes);

// Combined attributes = ParameterAttributes + TypeAttributes (when parameter has no attributes)
Assert.Equal(attributes.TypeAttributes, attributes.Attributes);
}

[Fact]
Expand Down
Loading