Пример #1
0
        public void CreateCache()
        {
            removedKey    = null;
            expiredValue  = null;
            removalReason = CacheItemRemovedReason.Unknown;

            factory  = new CacheManagerFactory(TestConfigurationSource.GenerateConfiguration());
            cacheMgr = (CacheManager)factory.Create("SmallInMemoryPersistence");
        }
        public void CallingDifferentFactoryTwiceReturnsDifferentInstances()
        {
            CacheManager cacheOne = factory.Create("InMemoryPersistence");

            CacheManagerFactory secondFactory = new CacheManagerFactory(TestConfigurationSource.GenerateConfiguration());
            CacheManager        cacheTwo      = secondFactory.Create("InMemoryPersistence");

            Assert.IsFalse(object.ReferenceEquals(cacheOne, cacheTwo), "Different factories should always return different instances for same instance name");
        }
Пример #3
0
        public void StartCacheProcesses()
        {
            factory           = new CacheManagerFactory(TestConfigurationSource.GenerateConfiguration());
            shortCacheManager = factory.Create("ShortInMemoryPersistence");
            smallCacheManager = factory.Create("SmallInMemoryPersistence");

            expiredKeys    = "";
            expiredValues  = "";
            removalReasons = "";
        }
Пример #4
0
        public void CanCreateIsolatedStorageCacheManager()
        {
            cacheManager.Add("bab", "foo");
            Assert.AreEqual(1, cacheManager.Count);

            CacheManagerFactory differentFactory      = new CacheManagerFactory(TestConfigurationSource.GenerateConfiguration());
            CacheManager        differentCacheManager = differentFactory.Create("InIsoStorePersistence");

            int count = differentCacheManager.Count;

            differentCacheManager.Dispose();

            Assert.AreEqual(1, count, "If we actually persisted added item, different cache manager should see item, too.");
        }
        public void StartCacheProcesses()
        {
            sharedLock       = new object();
            callbackCount    = 0;
            callbackReason   = CacheItemRemovedReason.Unknown;
            exceptionMessage = "";

            var defaultProvider = TypeRegistrationsProvider.CreateDefaultProvider();

            var registrationProvider = new CompositeTypeRegistrationsProviderLocator(defaultProvider, new RaceConditionSimulatingExpirationTaskRegistrationProvider());

            IUnityContainer     container           = new UnityContainer();
            var                 configurator        = new UnityContainerConfigurator(container);
            UnityServiceLocator unityServiceLocator = new UnityServiceLocator(container);

            EnterpriseLibraryContainer.ConfigureContainer(registrationProvider, configurator, TestConfigurationSource.GenerateConfiguration());

            cacheManager = (CacheManager)unityServiceLocator.GetInstance <ICacheManager>("ShortInMemoryPersistence");
        }
 public void CreateFactory()
 {
     factory = new CacheManagerFactory(TestConfigurationSource.GenerateConfiguration());
 }
        public void StartCacheProcesses()
        {
            sharedLock       = new object();
            callbackCount    = 0;
            callbackReason   = CacheItemRemovedReason.Unknown;
            exceptionMessage = "";

            cacheManager = MockCacheManagerFactory.Create("ShortInMemoryPersistence", TestConfigurationSource.GenerateConfiguration());
        }
Пример #8
0
 public void CreateCacheManager()
 {
     factory      = new CacheManagerFactory(TestConfigurationSource.GenerateConfiguration());
     cacheManager = factory.Create("InIsoStorePersistence");
     cacheManager.Flush();
 }