@@ -48,9 +48,9 @@ public void set_cache_to_predefined_value()
4848 var client = new HttpClient ( _server ) ;
4949 var result = client . GetAsync ( _url + "Get_c100_s100" ) . Result ;
5050
51- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_c100_s100:application/json" ) ) , Times . Exactly ( 2 ) ) ;
51+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_c100_s100:application/json; charset=utf-8 " ) ) , Times . Exactly ( 2 ) ) ;
5252 _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_c100_s100" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , null ) , Times . Once ( ) ) ;
53- _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_c100_s100:application/json" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , It . Is < string > ( x => x == "sample-get_c100_s100" ) ) , Times . Once ( ) ) ;
53+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_c100_s100:application/json; charset=utf-8 " ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , It . Is < string > ( x => x == "sample-get_c100_s100" ) ) , Times . Once ( ) ) ;
5454 }
5555
5656 [ Test ]
@@ -60,10 +60,10 @@ public void set_cache_to_predefined_value_c100_s0()
6060 var result = client . GetAsync ( _url + "Get_c100_s0" ) . Result ;
6161
6262 // NOTE: Should we expect the _cache to not be called at all if the ServerTimeSpan is 0?
63- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_c100_s0:application/json" ) ) , Times . Once ( ) ) ;
63+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_c100_s0:application/json; charset=utf-8 " ) ) , Times . Once ( ) ) ;
6464 // NOTE: Server timespan is 0, so there should not have been any Add at all.
6565 _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_c100_s0" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , null ) , Times . Never ( ) ) ;
66- _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_c100_s0:application/json" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 1 ) ) , It . Is < string > ( x => x == "sample-get_c100_s0" ) ) , Times . Never ( ) ) ;
66+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_c100_s0:application/json; charset=utf-8 " ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 1 ) ) , It . Is < string > ( x => x == "sample-get_c100_s0" ) ) , Times . Never ( ) ) ;
6767 }
6868
6969 [ Test ]
@@ -92,7 +92,7 @@ public void not_cache_add_when_no_content()
9292 var client = new HttpClient ( _server ) ;
9393 var result = client . GetAsync ( _url + "Get_request_noContent" ) . Result ;
9494
95- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_request_nocontent:application/json" ) ) , Times . Exactly ( 2 ) ) ;
95+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_request_nocontent:application/json; charset=utf-8 " ) ) , Times . Exactly ( 2 ) ) ;
9696 _cache . Verify ( s => s . Add ( It . IsAny < string > ( ) , It . IsAny < object > ( ) , It . IsAny < DateTimeOffset > ( ) , It . IsAny < string > ( ) ) , Times . Never ( ) ) ;
9797 }
9898
@@ -104,9 +104,9 @@ public void set_cache_to_predefined_value_respect_formatter_through_accept_heade
104104 req . Headers . Accept . Add ( new MediaTypeWithQualityHeaderValue ( "text/xml" ) ) ;
105105 var result = client . SendAsync ( req ) . Result ;
106106
107- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_c100_s100:text/xml" ) ) , Times . Exactly ( 2 ) ) ;
107+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_c100_s100:text/xml; charset=utf-8 " ) ) , Times . Exactly ( 2 ) ) ;
108108 _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_c100_s100" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , null ) , Times . Once ( ) ) ;
109- _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_c100_s100:text/xml" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , It . Is < string > ( x => x == "sample-get_c100_s100" ) ) , Times . Once ( ) ) ;
109+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_c100_s100:text/xml; charset=utf-8 " ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , It . Is < string > ( x => x == "sample-get_c100_s100" ) ) , Times . Once ( ) ) ;
110110 }
111111
112112 [ Test ]
@@ -118,9 +118,9 @@ public void set_cache_to_predefined_value_respect_formatter_through_content_type
118118 req . Content . Headers . ContentType = new MediaTypeHeaderValue ( "text/xml" ) ;
119119 var result = client . SendAsync ( req ) . Result ;
120120
121- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_c100_s100:text/xml" ) ) , Times . Exactly ( 2 ) ) ;
121+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_c100_s100:text/xml; charset=utf-8 " ) ) , Times . Exactly ( 2 ) ) ;
122122 _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_c100_s100" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , null ) , Times . Once ( ) ) ;
123- _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_c100_s100:text/xml" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , It . Is < string > ( x => x == "sample-get_c100_s100" ) ) , Times . Exactly ( 1 ) ) ;
123+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_c100_s100:text/xml; charset=utf-8 " ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , It . Is < string > ( x => x == "sample-get_c100_s100" ) ) , Times . Exactly ( 1 ) ) ;
124124 }
125125
126126 [ Test ]
@@ -129,9 +129,9 @@ public void set_cache_dont_exclude_querystring()
129129 var client = new HttpClient ( _server ) ;
130130 var result = client . GetAsync ( _url + "Get_s50_exclude_false/1?xxx=2" ) . Result ;
131131
132- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_false-id=1&xxx=2:application/json" ) ) , Times . Exactly ( 2 ) ) ;
132+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_false-id=1&xxx=2:application/json; charset=utf-8 " ) ) , Times . Exactly ( 2 ) ) ;
133133 _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_false" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , null ) , Times . Once ( ) ) ;
134- _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_false-id=1&xxx=2:application/json" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_false" ) ) , Times . Once ( ) ) ;
134+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_false-id=1&xxx=2:application/json; charset=utf-8 " ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_false" ) ) , Times . Once ( ) ) ;
135135 }
136136
137137 [ Test ]
@@ -140,9 +140,9 @@ public void set_cache_dont_exclude_querystring_duplicate_action_arg_in_querystri
140140 var client = new HttpClient ( _server ) ;
141141 var result = client . GetAsync ( _url + "Get_s50_exclude_false/1?id=1" ) . Result ;
142142
143- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_false-id=1:application/json" ) ) , Times . Exactly ( 2 ) ) ;
143+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_false-id=1:application/json; charset=utf-8 " ) ) , Times . Exactly ( 2 ) ) ;
144144 _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_false" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , null ) , Times . Once ( ) ) ;
145- _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_false-id=1:application/json" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_false" ) ) , Times . Once ( ) ) ;
145+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_false-id=1:application/json; charset=utf-8 " ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_false" ) ) , Times . Once ( ) ) ;
146146 }
147147
148148 [ Test ]
@@ -152,13 +152,13 @@ public void set_cache_do_exclude_querystring()
152152 var result = client . GetAsync ( _url + "Get_s50_exclude_true/1?xxx=1" ) . Result ;
153153
154154 //check
155- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_true-id=1:application/json" ) ) , Times . Exactly ( 2 ) ) ;
155+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_true-id=1:application/json; charset=utf-8 " ) ) , Times . Exactly ( 2 ) ) ;
156156
157157 //base
158158 _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_true" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , null ) , Times . Once ( ) ) ;
159159
160160 //actual
161- _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_true-id=1:application/json" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_true" ) ) , Times . Once ( ) ) ;
161+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_true-id=1:application/json; charset=utf-8 " ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_true" ) ) , Times . Once ( ) ) ;
162162 }
163163
164164 [ Test ]
@@ -168,13 +168,13 @@ public void set_cache_do_exclude_querystring_do_not_exclude_action_arg_even_if_p
168168 var result = client . GetAsync ( _url + "Get_s50_exclude_true?id=1" ) . Result ;
169169
170170 //check
171- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_true-id=1:application/json" ) ) , Times . Exactly ( 2 ) ) ;
171+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_true-id=1:application/json; charset=utf-8 " ) ) , Times . Exactly ( 2 ) ) ;
172172
173173 //base
174174 _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_true" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , null ) , Times . Once ( ) ) ;
175175
176176 //actual
177- _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_true-id=1:application/json" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_true" ) ) , Times . Once ( ) ) ;
177+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_true-id=1:application/json; charset=utf-8 " ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_true" ) ) , Times . Once ( ) ) ;
178178 }
179179
180180 [ Test ]
@@ -183,9 +183,9 @@ public void callback_at_the_end_is_excluded_querystring()
183183 var client = new HttpClient ( _server ) ;
184184 var result = client . GetAsync ( _url + "Get_s50_exclude_fakecallback?id=1&callback=abc" ) . Result ;
185185
186- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback-id=1:application/json" ) ) , Times . Exactly ( 2 ) ) ;
186+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback-id=1:application/json; charset=utf-8 " ) ) , Times . Exactly ( 2 ) ) ;
187187 _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , null ) , Times . Once ( ) ) ;
188- _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback-id=1:application/json" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback" ) ) , Times . Once ( ) ) ;
188+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback-id=1:application/json; charset=utf-8 " ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback" ) ) , Times . Once ( ) ) ;
189189 }
190190
191191 [ Test ]
@@ -194,9 +194,9 @@ public void callback_at_the_beginning_is_excluded_querystring()
194194 var client = new HttpClient ( _server ) ;
195195 var result = client . GetAsync ( _url + "Get_s50_exclude_fakecallback?callback=abc&id=1" ) . Result ;
196196
197- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback-id=1:application/json" ) ) , Times . Exactly ( 2 ) ) ;
197+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback-id=1:application/json; charset=utf-8 " ) ) , Times . Exactly ( 2 ) ) ;
198198 _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , null ) , Times . Once ( ) ) ;
199- _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback-id=1:application/json" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback" ) ) , Times . Once ( ) ) ;
199+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback-id=1:application/json; charset=utf-8 " ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback" ) ) , Times . Once ( ) ) ;
200200 }
201201
202202 [ Test ]
@@ -205,9 +205,9 @@ public void callback_in_the_middle_is_excluded_querystring()
205205 var client = new HttpClient ( _server ) ;
206206 var result = client . GetAsync ( _url + "Get_s50_exclude_fakecallback?de=xxx&callback=abc&id=1" ) . Result ;
207207
208- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback-id=1&de=xxx:application/json" ) ) , Times . Exactly ( 2 ) ) ;
208+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback-id=1&de=xxx:application/json; charset=utf-8 " ) ) , Times . Exactly ( 2 ) ) ;
209209 _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , null ) , Times . Once ( ) ) ;
210- _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback-id=1&de=xxx:application/json" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback" ) ) , Times . Once ( ) ) ;
210+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback-id=1&de=xxx:application/json; charset=utf-8 " ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback" ) ) , Times . Once ( ) ) ;
211211 }
212212
213213 [ Test ]
@@ -216,9 +216,9 @@ public void callback_alone_is_excluded_querystring()
216216 var client = new HttpClient ( _server ) ;
217217 var result = client . GetAsync ( _url + "Get_s50_exclude_fakecallback?callback=abc" ) . Result ;
218218
219- _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback:application/json" ) ) , Times . Exactly ( 2 ) ) ;
219+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback:application/json; charset=utf-8 " ) ) , Times . Exactly ( 2 ) ) ;
220220 _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , null ) , Times . Once ( ) ) ;
221- _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback:application/json" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback" ) ) , Times . Once ( ) ) ;
221+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback:application/json; charset=utf-8 " ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 50 ) ) , It . Is < string > ( x => x == "sample-get_s50_exclude_fakecallback" ) ) , Times . Once ( ) ) ;
222222 }
223223
224224 [ Test ]
0 commit comments