@@ -267,6 +267,30 @@ public void etag_not_match_304_if_none_match()
267267 Assert . AreEqual ( HttpStatusCode . OK , result . StatusCode ) ;
268268 }
269269
270+ [ Test ]
271+ public void can_handle_ihttpactionresult_with_default_media_type ( )
272+ {
273+ var client = new HttpClient ( _server ) ;
274+ var result = client . GetAsync ( _url + "Get_ihttpactionresult" ) . Result ;
275+
276+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_ihttpactionresult:application/json; charset=utf-8" ) ) , Times . Exactly ( 2 ) ) ;
277+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_ihttpactionresult" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , null ) , Times . Once ( ) ) ;
278+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_ihttpactionresult:application/json; charset=utf-8" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , It . Is < string > ( x => x == "sample-get_ihttpactionresult" ) ) , Times . Once ( ) ) ;
279+ }
280+
281+ [ Test ]
282+ public void can_handle_ihttpactionresult_with_non_default_media_type ( )
283+ {
284+ var client = new HttpClient ( _server ) ;
285+ var req = new HttpRequestMessage ( HttpMethod . Get , _url + "Get_ihttpactionresult" ) ;
286+ req . Headers . Accept . Add ( new MediaTypeWithQualityHeaderValue ( "text/xml" ) ) ;
287+ var result = client . SendAsync ( req ) . Result ;
288+
289+ _cache . Verify ( s => s . Contains ( It . Is < string > ( x => x == "sample-get_ihttpactionresult:text/xml; charset=utf-8" ) ) , Times . Exactly ( 2 ) ) ;
290+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_ihttpactionresult" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , null ) , Times . Once ( ) ) ;
291+ _cache . Verify ( s => s . Add ( It . Is < string > ( x => x == "sample-get_ihttpactionresult:text/xml; charset=utf-8" ) , It . IsAny < object > ( ) , It . Is < DateTimeOffset > ( x => x <= DateTime . Now . AddSeconds ( 100 ) ) , It . Is < string > ( x => x == "sample-get_ihttpactionresult" ) ) , Times . Once ( ) ) ;
292+ }
293+
270294
271295 //[Test]
272296 //public void must_add_querystring_to_cache_params()
0 commit comments