@@ -14,7 +14,7 @@ public class FormatUtilitiesTests
1414 public static IEnumerable < object [ ] > DefaultExtensions =
1515 Configuration . Default . ImageFormats . SelectMany ( f => f . FileExtensions . Select ( e => new object [ ] { e , e } ) ) ;
1616
17- private static readonly FormatUtilities FormatUtilities = new FormatUtilities ( Options . Create ( new ImageSharpMiddlewareOptions ( ) ) ) ;
17+ private static readonly FormatUtilities FormatUtilities = new ( Options . Create ( new ImageSharpMiddlewareOptions ( ) ) ) ;
1818
1919 [ Theory ]
2020 [ MemberData ( nameof ( DefaultExtensions ) ) ]
@@ -27,22 +27,29 @@ public void GetExtensionShouldMatchDefaultExtensions(string expected, string ext
2727 [ Fact ]
2828 public void GetExtensionShouldNotMatchExtensionWithoutDotPrefix ( )
2929 {
30- const string Uri = "http://www.example.org/some/path/to/bmpimage" ;
31- Assert . Null ( FormatUtilities . GetExtensionFromUri ( Uri ) ) ;
30+ const string uri = "http://www.example.org/some/path/to/bmpimage" ;
31+ Assert . Null ( FormatUtilities . GetExtensionFromUri ( uri ) ) ;
3232 }
3333
3434 [ Fact ]
3535 public void GetExtensionShouldIgnoreQueryStringWithoutFormatParamter ( )
3636 {
37- const string Uri = "http://www.example.org/some/path/to/image.bmp?width=300&foo=.png" ;
38- Assert . Equal ( "bmp" , FormatUtilities . GetExtensionFromUri ( Uri ) ) ;
37+ const string uri = "http://www.example.org/some/path/to/image.bmp?width=300&foo=.png" ;
38+ Assert . Equal ( "bmp" , FormatUtilities . GetExtensionFromUri ( uri ) ) ;
3939 }
4040
4141 [ Fact ]
4242 public void GetExtensionShouldAcknowledgeQueryStringFormatParameter ( )
4343 {
44- const string Uri = "http://www.example.org/some/path/to/image.bmp?width=300&format=png" ;
45- Assert . Equal ( "png" , FormatUtilities . GetExtensionFromUri ( Uri ) ) ;
44+ const string uri = "http://www.example.org/some/path/to/image.bmp?width=300&format=png" ;
45+ Assert . Equal ( "png" , FormatUtilities . GetExtensionFromUri ( uri ) ) ;
46+ }
47+
48+ [ Fact ]
49+ public void GetExtensionShouldRejectInvalidQueryStringFormatParameter ( )
50+ {
51+ const string uri = "http://www.example.org/some/path/to/image.bmp?width=300&format=invalid" ;
52+ Assert . Null ( FormatUtilities . GetExtensionFromUri ( uri ) ) ;
4653 }
4754 }
4855}
0 commit comments