示例#1
0
        public void Cached_client_does_return_NotModified_when_MustRevalidate()
        {
            ClientCacheMaxAge.Count = 0;
            var request = new ClientCacheMustRevalidate {
                Id = 7, Value = "foo"
            };
            var client = new CachedServiceClient(new JsonServiceClient(Config.ListeningOn));

            ClientCacheMustRevalidate response;

            response = client.Get(request);
            Assert.That(ClientCacheMustRevalidate.Count, Is.EqualTo(1));
            Assert.That(client.NotModifiedHits, Is.EqualTo(0));
            AssertEquals(response, request);

            response = client.Get(request);
            Assert.That(ClientCacheMustRevalidate.Count, Is.EqualTo(1));
            Assert.That(client.NotModifiedHits, Is.EqualTo(1));
            AssertEquals(response, request);
        }
示例#2
0
 public object Any(ClientCacheMustRevalidate request)
 {
     Interlocked.Increment(ref ClientCacheMustRevalidate.Count);
     return(request);
 }