public void Disk_cache_set_get_set_get(string key, string key2)
        {
            //Arrange
            var cache   = new DiskCacheStore(path, new TimeSpan(0, 0, 5));
            var context = new NancyContext()
            {
                Response = new FakeResponse()
                {
                }
            };

            //Act
            cache.Set(key, context, DateTime.UtcNow.AddSeconds(5));
            var response = cache.Get(key);

            System.Threading.Thread.Sleep(5000);

            cache.Set(key2, context, DateTime.UtcNow.AddSeconds(5));

            var response2 = cache.Get(key);
            var response3 = cache.Get(key2);

            cache.Remove(key);
            cache.Remove(key2);

            //Assert
            Assert.NotNull(response);
            Assert.Null(response2); //Expired
            Assert.NotNull(response3);
            Assert.NotNull(context.Response);
        }
        public void Disk_cache_set_set_get(string key)
        {
            //Arrange
            var expirationDate = DateTime.UtcNow.AddMinutes(15);
            var cache          = new DiskCacheStore(path);
            var context        = new NancyContext()
            {
                Response = new FakeResponse()
                {
                }
            };

            //Act
            cache.Set(key, context, expirationDate);
            cache.Set(key, context, expirationDate);
            var response = cache.Get(key);

            cache.Remove(key);

            //Assert
            Assert.Equal(context.Response.ContentType, response.ContentType);
            Assert.Equal(context.Response.StatusCode, response.StatusCode);
            Assert.Equal(expirationDate, response.Expiration);
            Assert.Equal(context.Response.Contents.ConvertStream(), response.Contents.ConvertStream());
        }
        public void Disk_cache_set_remove_get(string key)
        {
            //Arrange
            var expirationDate = DateTime.Now.AddMinutes(15);
            var cache          = new DiskCacheStore(path);
            var context        = new NancyContext()
            {
                Response = new FakeResponse()
                {
                }
            };

            //Act
            cache.Set(key, context, expirationDate);

            cache.Remove(key);

            var response = cache.Get(key);

            //Assert
            Assert.Null(response);
            Assert.NotNull(context.Response);
        }