@@ -14,7 +14,7 @@ public class FormatUtilitiesTests
14
14
public static IEnumerable < object [ ] > DefaultExtensions =
15
15
Configuration . Default . ImageFormats . SelectMany ( f => f . FileExtensions . Select ( e => new object [ ] { e , e } ) ) ;
16
16
17
- private static readonly FormatUtilities FormatUtilities = new FormatUtilities ( Options . Create ( new ImageSharpMiddlewareOptions ( ) ) ) ;
17
+ private static readonly FormatUtilities FormatUtilities = new ( Options . Create ( new ImageSharpMiddlewareOptions ( ) ) ) ;
18
18
19
19
[ Theory ]
20
20
[ MemberData ( nameof ( DefaultExtensions ) ) ]
@@ -27,22 +27,29 @@ public void GetExtensionShouldMatchDefaultExtensions(string expected, string ext
27
27
[ Fact ]
28
28
public void GetExtensionShouldNotMatchExtensionWithoutDotPrefix ( )
29
29
{
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 ) ) ;
32
32
}
33
33
34
34
[ Fact ]
35
35
public void GetExtensionShouldIgnoreQueryStringWithoutFormatParamter ( )
36
36
{
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 ) ) ;
39
39
}
40
40
41
41
[ Fact ]
42
42
public void GetExtensionShouldAcknowledgeQueryStringFormatParameter ( )
43
43
{
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 ) ) ;
46
53
}
47
54
}
48
55
}
0 commit comments