public void Create() { var factory = new MemoryCacheFactory(new FoobarCache()); var cache = (Memory.MemoryCache)factory.Create("Foobar", new CacheEntryOptions()); Assert.Equal("Foobar", cache.Name); }
public void Create_Arguments_Not_Allow_Null_Or_White_Space(string name, string optionsIndicator) { CacheEntryOptions options = optionsIndicator == null ? null : new CacheEntryOptions(); var factory = new MemoryCacheFactory(new FoobarCache()); Assert.ThrowsAny <ArgumentException>(() => factory.Create(name, options)); }
public AccountApiTest() { tokenManager = new TokenManager($"{Environment.CurrentDirectory}\\Certificats\\token.json"); memoryCache = new MemoryCacheFactory().CreateInstance(token = tokenManager.LoadToken()); var config = new ConfigTest(); var httpClient = new HttpClient(); var api = new RevolutApiClient(config, token.AccessToken, httpClient, memoryCache); _accountClient = new AccountApiClient(api); }
public TokenFactoryTest() { tokenManager = new TokenManager($"{Environment.CurrentDirectory}\\Certificats\\token.json"); token = tokenManager.LoadToken(); memoryCache = new MemoryCacheFactory().CreateInstance(token); var config = new ConfigTest(); var httpClient = new HttpClient(); var api = new RevolutApiClient(config, httpClient); tokenFactory = new TokenFactory(new AuthorizationApiClient(api, config), memoryCache); }
public ICacheConstructionFactory GetCacheConstructionFactoryUsingTypeValue(string cacheTypeValue, CacheConfig config) { ICacheConstructionFactory cacheFactory; var normalisedCacheToUse = !string.IsNullOrWhiteSpace(cacheTypeValue) ? cacheTypeValue.ToLowerInvariant() : string.Empty; switch (normalisedCacheToUse) { case CacheTypes.MemoryCache: cacheFactory = new MemoryCacheFactory(_logger, config); break; case CacheTypes.WebCache: cacheFactory = new WebCacheFactory(_logger, config); break; case CacheTypes.AppFabricCache: cacheFactory = new AppFabricCacheFactory(_logger, config); break; case CacheTypes.memcached: cacheFactory = new memcachedCacheFactory(_logger, config); break; case CacheTypes.redis: cacheFactory = new RedisCacheFactory(_logger, config); break; case CacheTypes.hybrid: throw new System.NotSupportedException("Hybrid configuration not supported at this time."); default: cacheFactory = new MemoryCacheFactory(_logger, config); break; } return(cacheFactory); }