示例#1
0
        public void RetrieveTest()
        {
            GenerateFakeHttpContext();

            var cache     = new HttpContextCache();
            var retrieved = cache.Retrieve <string>(TestKey);

            Assert.AreEqual(TestValue, retrieved);
        }
示例#2
0
        public void RetrieveNonExistingTest()
        {
            var tmpKey = TestKey + "123";

            GenerateFakeHttpContext();

            var cache     = new HttpContextCache();
            var retrieved = cache.Retrieve <string>(tmpKey);

            Assert.IsNull(retrieved);
        }
示例#3
0
        public void RemoveTest()
        {
            GenerateFakeHttpContext();

            var cache = new HttpContextCache();

            cache.Remove(TestKey);

            var retrieved = cache.Retrieve <string>(TestKey);

            Assert.IsNull(retrieved);
        }
示例#4
0
        public void StoreTest()
        {
            const string expectedKey   = "test2";
            const string expectedValue = "test2";

            GenerateFakeHttpContext();

            var cache = new HttpContextCache();

            cache.Store(expectedKey, expectedValue);

            var retrieved = cache.Retrieve <string>(expectedKey);

            Assert.AreEqual(expectedValue, retrieved);
        }