Exemple #1
0
        public void TestGet()
        {
            using (var mc = new MemcachedStore())
            {
                mc.AddOrUpdate(_key, _response);

                HttpResponseMessage message;

                var success = mc.TryGetValue(_key, out message);
                Assert.AreEqual(_response.Content.Headers.ContentLength, message.Content.Headers.ContentLength);
                Assert.AreEqual(_response.Content.ReadAsStringAsync().Result,
                                message.Content.ReadAsStringAsync().Result);
                Assert.IsTrue(success);
            }
        }
        public void TestGet()
        {
            using (var mc = new MemcachedStore())
            {
                mc.AddOrUpdate(_key, _response);

                HttpResponseMessage message;

                var success = mc.TryGetValue(_key, out message);
                Assert.AreEqual(_response.Content.Headers.ContentLength, message.Content.Headers.ContentLength);
                Assert.AreEqual(_response.Content.ReadAsStringAsync().Result,
                    message.Content.ReadAsStringAsync().Result);
                Assert.IsTrue(success);
            }
        }
        public void TestRemove()
        {
            using (var mc = new MemcachedStore())
            {
                mc.AddOrUpdate(_key, _response);
                HttpResponseMessage message;

                var success = mc.TryRemove(_key);
                var getFailure = mc.TryGetValue(_key, out message);

                var failure = mc.TryRemove(_key);

                Assert.IsTrue(success);
                Assert.IsTrue(!failure);
                Assert.IsTrue(!getFailure);
            }
        }
Exemple #4
0
        public void TestRemove()
        {
            using (var mc = new MemcachedStore())
            {
                mc.AddOrUpdate(_key, _response);
                HttpResponseMessage message;


                var success    = mc.TryRemove(_key);
                var getFailure = mc.TryGetValue(_key, out message);

                var failure = mc.TryRemove(_key);

                Assert.IsTrue(success);
                Assert.IsTrue(!failure);
                Assert.IsTrue(!getFailure);
            }
        }