@@ -58,9 +58,41 @@ public void ParseQueryWithEmptyKeyWorks()
58
58
[ Fact ]
59
59
public void ParseQueryWithEncodedKeyWorks ( )
60
60
{
61
- var collection = QueryHelpers . ParseQuery ( "?fields%5BtodoItems%5D" ) ;
61
+ var collection = QueryHelpers . ParseQuery ( "?fields+ %5BtodoItems%5D" ) ;
62
62
Assert . Single ( collection ) ;
63
- Assert . Equal ( "" , collection [ "fields[todoItems]" ] . FirstOrDefault ( ) ) ;
63
+ Assert . Equal ( "" , collection [ "fields [todoItems]" ] . FirstOrDefault ( ) ) ;
64
+ }
65
+
66
+ [ Fact ]
67
+ public void ParseQueryWithEncodedValueWorks ( )
68
+ {
69
+ var collection = QueryHelpers . ParseQuery ( "?=fields+%5BtodoItems%5D" ) ;
70
+ Assert . Single ( collection ) ;
71
+ Assert . Equal ( "fields [todoItems]" , collection [ "" ] . FirstOrDefault ( ) ) ;
72
+ }
73
+
74
+ [ Fact ]
75
+ public void ParseQueryWithEncodedKeyEmptyValueWorks ( )
76
+ {
77
+ var collection = QueryHelpers . ParseQuery ( "?fields+%5BtodoItems%5D=" ) ;
78
+ Assert . Single ( collection ) ;
79
+ Assert . Equal ( "" , collection [ "fields [todoItems]" ] . FirstOrDefault ( ) ) ;
80
+ }
81
+
82
+ [ Fact ]
83
+ public void ParseQueryWithEncodedKeyEncodedValueWorks ( )
84
+ {
85
+ var collection = QueryHelpers . ParseQuery ( "?fields+%5BtodoItems%5D=%5B+1+%5D" ) ;
86
+ Assert . Single ( collection ) ;
87
+ Assert . Equal ( "[ 1 ]" , collection [ "fields [todoItems]" ] . FirstOrDefault ( ) ) ;
88
+ }
89
+
90
+ [ Fact ]
91
+ public void ParseQueryWithEncodedKeyEncodedValuesWorks ( )
92
+ {
93
+ var collection = QueryHelpers . ParseQuery ( "?fields+%5BtodoItems%5D=%5B+1+%5D&fields+%5BtodoItems%5D=%5B+2+%5D" ) ;
94
+ Assert . Single ( collection ) ;
95
+ Assert . Equal ( new [ ] { "[ 1 ]" , "[ 2 ]" } , collection [ "fields [todoItems]" ] ) ;
64
96
}
65
97
66
98
[ Theory ]
0 commit comments