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

            ClientCacheMaxAge response;

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

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