Пример #1
0
        public async Task SetCacheKeyTest()
        {
            //Clear the cache
            await JsonCache.ClearAll();

            await JsonCache.Set("test", "result set");

            var result = await JsonCache.GetAsync("test", () => LongRunningOperation("result 2"));

            Assert.AreEqual("result set", result);
        }
Пример #2
0
        public async Task SetExpireDateInValidTest()
        {
            //Clear the cache
            await JsonCache.ClearAll();

            await JsonCache.Set("test", "result set", DateTime.Now.AddDays(-1));

            var emptyResult = await JsonCache.GetFromCache <string>("test");

            Assert.AreEqual(null, emptyResult);
        }
Пример #3
0
        public async Task GetCacheKeyTest()
        {
            //Clear the cache
            await JsonCache.ClearAll();

            var emptyResult = await JsonCache.GetFromCache <string>("test");

            Assert.AreEqual(null, emptyResult);

            await JsonCache.Set("test", "result set");

            var result = await JsonCache.GetFromCache <string>("test");

            Assert.AreEqual("result set", result);
        }