File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,31 @@ public void UrlDecodeNoThrow()
2626 Assert . AreEqual ( str , HttpUtility . UrlDecode ( str ) ) ;
2727 }
2828
29+ [ TestMethod ]
30+ public void UrlDecodeTest ( )
31+ {
32+ for ( char c = char . MinValue ; c < '\uD800 ' ; c ++ )
33+ {
34+ byte [ ] bIn ;
35+ bIn = Encoding . UTF8 . GetBytes ( c . ToString ( ) ) ;
36+ MemoryStream encodedValueBytes = new MemoryStream ( ) ;
37+
38+ // build expected result for UrlEncode
39+ for ( int i = 0 ; i < bIn . Length ; i ++ )
40+ {
41+ UrlEncodeChar ( ( char ) bIn [ i ] , encodedValueBytes , false ) ;
42+ }
43+
44+ byte [ ] bOut = encodedValueBytes . ToArray ( ) ;
45+ string encodedValue = Encoding . UTF8 . GetString ( bOut , 0 , bOut . Length ) ;
46+
47+ string decodedValue = HttpUtility . UrlDecode ( encodedValue ) ;
48+
49+ Assert . AreEqual ( c . ToString ( ) , decodedValue ,
50+ $ "Expecting UrlEncode of '{ c } ' ({ ( int ) c } ) as [{ c } ] got { decodedValue } ") ;
51+ }
52+ }
53+
2954 [ TestMethod ]
3055 public void UrlEncodeTest ( )
3156 {
You can’t perform that action at this time.
0 commit comments