public void CanGetValueFromCache()
        {
            var cache = new InMemoryKeyValueCache();

            cache.Add("test", "some value");
            Assert.AreEqual("some value", cache.Get("test"));
        }
        public void CanAddValueToCacheWithExpiration()
        {
            var cache = new InMemoryKeyValueCache();
            var expiration = 1.Seconds();

            cache.Add("test", "some value", DateTime.Now.AddTicks(expiration.Ticks));
            Assert.AreEqual("some value", cache.Get("test"));

            Thread.Sleep(expiration);

            Assert.IsNull(cache.Get("test"));
        }
        public void CanDisposeCache()
        {
            var cache = new InMemoryKeyValueCache();

            cache.Add("test", "some value");
            Assert.AreEqual("some value", cache.Get("test"));

            cache.Dispose();

            var cacheNew = new InMemoryKeyValueCache();
            Assert.IsNull(cache.Get("test"));
            Assert.IsNull(cacheNew.Get("test"));
        }