コード例 #1
0
        public void AddToCacheReturnsGuid()
        {
            FileBasedSessionCache cache = new FileBasedSessionCache();

            cache.StoreLocation = cacheLocation;
            string sessionToken = cache.AddToCache("johndoe");
            string userName     = cache.RetrieveFromCache(sessionToken);
            Guid   sessionGuid  = new Guid(sessionToken);

            Assert.AreEqual("johndoe", userName);
        }
コード例 #2
0
        public void RemoveFromCacheRemovesSession()
        {
            FileBasedSessionCache cache = new FileBasedSessionCache();

            cache.StoreLocation = cacheLocation;
            string sessionToken = cache.AddToCache("johndoe");

            cache.RemoveFromCache(sessionToken);
            string userName = cache.RetrieveFromCache(sessionToken);

            Assert.IsNull(userName);
        }