Пример #1
0
        public void Get_OnExistingValue_ShouldReturnStoredObject()
        {
            var cache = new InProcessCache();

            cache.Set("abc", this);

            var actualStoredItem = cache.Get <InProcessCacheTests>("abc");

            Assert.AreEqual(this, actualStoredItem);
        }
Пример #2
0
        public void expired_in_put()
        {
            const string testKey = "TestKey";
            const string testValue = "TestValue";

            ICache cache = new InProcessCache();
            cache.Remove(testKey);
            cache.Set(testKey, testValue, new TimeSpan(0, 0, 1));
            Assert.IsTrue(cache.Exists(testKey));
        }
Пример #3
0
        public void expired_at_put()
        {
            const string testKey = "TestKey";
            const string testValue = "TestValue";

            ICache cache = new InProcessCache();
            cache.Remove(testKey);
            cache.Set(testKey, testValue, DateTime.Now.AddMinutes(1));
            Assert.IsTrue(cache.Exists(testKey));
        }
        public void expired_in_put()
        {
            const string testKey   = "TestKey";
            const string testValue = "TestValue";

            ICache cache = new InProcessCache();

            cache.Remove(testKey);
            cache.Set(testKey, testValue, new TimeSpan(0, 0, 1));
            Assert.IsTrue(cache.Exists(testKey));
        }
        public void expired_at_put()
        {
            const string testKey   = "TestKey";
            const string testValue = "TestValue";

            ICache cache = new InProcessCache();

            cache.Remove(testKey);
            cache.Set(testKey, testValue, DateTime.Now.AddMinutes(1));
            Assert.IsTrue(cache.Exists(testKey));
        }
Пример #6
0
        public void GetGroupTest()
        {
            var keys = new List<string> {"key1", "key2"};
            var cache = new InProcessCache();

            foreach(var key in keys)
                cache.Set(key, key);

            var values = cache.GetGroup<string>(keys);
            Assert.IsTrue(values.Count == 2);
        }
Пример #7
0
        public void basic_put_and_get()
        {
            const string testKey = "TestKey";
            const string testValue = "TestValue";

            ICache cache = new InProcessCache();
            cache.Remove(testKey);
            cache.Set(testKey, testValue);

            var actual = (string)cache.Get(testKey);

            Assert.AreEqual(testValue, actual);
            Assert.IsTrue(cache.Exists(testKey));
        }
        public void basic_put_and_get()
        {
            const string testKey   = "TestKey";
            const string testValue = "TestValue";

            ICache cache = new InProcessCache();

            cache.Remove(testKey);
            cache.Set(testKey, testValue);

            var actual = (string)cache.Get(testKey);

            Assert.AreEqual(testValue, actual);
            Assert.IsTrue(cache.Exists(testKey));
        }
        public void GetGroupTest()
        {
            var keys = new List <string> {
                "key1", "key2"
            };
            var cache = new InProcessCache();

            foreach (var key in keys)
            {
                cache.Set(key, key);
            }

            var values = cache.GetGroup <string>(keys);

            Assert.IsTrue(values.Count == 2);
        }
Пример #10
0
        public void Set_Valid_ShouldNotThrowException()
        {
            var cache = new InProcessCache();

            cache.Set("abc", this);
        }