コード例 #1
0
        public void Save()
        {
            var cacheKey  = CacheIntegrationTestHelper.GetRandomCacheKey();
            var cacheData = CacheAheadHelper.PopulateCacheMetadata <string>("Test", CachePolicies.FourHours);

            _InMemeoryCacheManager.Save(cacheKey, cacheData, CacheRegion.Global);
            var sucessfulSaveResult = _InMemeoryCacheManager.Contains <string>(cacheKey, CacheRegion.Global);

            Assert.IsTrue(sucessfulSaveResult.Exists);
        }
コード例 #2
0
        public void Contains()
        {
            var cacheKey  = CacheIntegrationTestHelper.GetRandomCacheKey();
            var cacheData = CacheAheadHelper.PopulateCacheMetadata <string>("Test", CachePolicies.FourHours);

            _InMemeoryCacheManager.Save(cacheKey, cacheData, CacheRegion.Global);
            var sucessfulSaveResult = _InMemeoryCacheManager.Contains <CachedObjectResponseContainer <string> >(cacheKey, CacheRegion.Global);

            Assert.IsTrue(sucessfulSaveResult.Exists);
            Assert.IsTrue(sucessfulSaveResult.CachedObj is CachedObjectResponseContainer <string>);
            Assert.IsTrue((sucessfulSaveResult.CachedObj as CachedObjectResponseContainer <string>).DataObject.Equals("Test"));
        }