Ejemplo n.º 1
0
        public void RemoveOnRemovesFromCorrectPartition()
        {
            firstCache.Add(new CacheItem("key", "value", CacheItemPriority.Low, null));

            secondCache.Remove("key");
            Assert.AreEqual(1, firstCache.Count);

            firstCache.Remove("key");
            Assert.AreEqual(0, firstCache.Count);
        }
        public void CanResolveDataBackingStoreWithOutEncryptionProvider()
        {
            const string         key  = "fooKey";
            DataCacheStorageData data = new DataCacheStorageData("Data Cache Storage", "CachingDatabase", "fooPartition");

            settings.BackingStores.Add(data);

            CacheManagerData managerData = new CacheManagerData("defaultCacheManager", 300, 200, 100, "Data Cache Storage");

            settings.CacheManagers.Add(managerData);
            settings.DefaultCacheManager = "defaultCacheManager";

            dbSettings.DefaultDatabase = "CachingDatabase";

            container = EnterpriseLibraryContainer.CreateDefaultContainer(configurationSource);
            DataBackingStore createdStore = container.GetInstance <DataBackingStore>("Data Cache Storage");

            Assert.IsNotNull(createdStore);
            createdStore.Add(new CacheItem(key, 1, CacheItemPriority.Low, null, null));
            Assert.AreEqual(1, createdStore.Count);
            createdStore.Remove(key);
            Assert.AreEqual(0, createdStore.Count);
        }