public void TryRemove()
        {
            var fake = A.Fake <IObjectCacheConnection>();

            A.CallTo(() => fake.Remove("key1", null));
            DateTime         utcExpiry = DateTime.Now;
            RedisObjectCache cache     = new RedisObjectCache("unitTest", new NameValueCollection());

            cache.cache = fake;
            cache.Remove("key1");
            A.CallTo(() => fake.Remove("key1", null)).MustHaveHappened();
        }
Beispiel #2
0
        public void RemoveWithoutSetTest()
        {
            using (new RedisServer())
            {
                NameValueCollection config = new NameValueCollection();
                config.Add("ssl", "false");
                RedisObjectCache provider = new RedisObjectCache("test", config);

                provider.Remove("key6", "testRegion");
                object data = provider.Get("key6", "testRegion");
                Assert.Equal(null, data);
            }
        }
Beispiel #3
0
        public void RemoveTest()
        {
            using (new RedisServer())
            {
                NameValueCollection config = new NameValueCollection();
                config.Add("ssl", "false");
                RedisObjectCache provider = new RedisObjectCache("test", config);

                DateTime utxExpiry = DateTime.UtcNow.AddSeconds(3);
                provider.Set("key7", "data7", utxExpiry, "testRegion");
                provider.Remove("key7", "testRegion");
                object data = provider.Get("key7", "testRegion");
                Assert.Equal(null, data);
            }
        }