File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Extensions Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -130,4 +130,21 @@ public static void ApplyValidationAttributes_Handles_RangeAttribute_Correctly(
130130 Assert . False ( schema . TryGetPropertyValue ( "exclusiveMaximum" , out _ ) ) ;
131131 }
132132 }
133+
134+ [ Fact ]
135+ public static void ApplyValidationAttributes_Handles_Invalid_RangeAttribute_Values ( )
136+ {
137+ // Arrange
138+ var rangeAttribute = new RangeAttribute ( typeof ( int ) , "foo" , "bar" ) ;
139+ var schema = new JsonObject ( ) ;
140+
141+ // Act
142+ schema . ApplyValidationAttributes ( [ rangeAttribute ] ) ;
143+
144+ // Assert
145+ Assert . False ( schema . TryGetPropertyValue ( "minimum" , out _ ) ) ;
146+ Assert . False ( schema . TryGetPropertyValue ( "maximum" , out _ ) ) ;
147+ Assert . False ( schema . TryGetPropertyValue ( "exclusiveMinimum" , out _ ) ) ;
148+ Assert . False ( schema . TryGetPropertyValue ( "exclusiveMaximum" , out _ ) ) ;
149+ }
133150}
You can’t perform that action at this time.
0 commit comments