private static DefaultConfigurationService GenerateService()
        {
            TestSerializationService  jsonSerializer = new TestSerializationService();
            TestMemoryCachingService  cachingService = new TestMemoryCachingService(TimeSpan.FromDays(1), false);
            DefaultConfigurationCache cache          = new DefaultConfigurationCache(cachingService,
                                                                                     jsonSerializer, TimeSpan.FromDays(1));
            DefaultConfigurationService service = new DefaultConfigurationService(cache);

            return(service);
        }
        private static Mock <ConfigurationCacheBase> GenerateCache(bool useStrict = true)
        {
            TestSerializationService      jsonSerializer = new TestSerializationService();
            TestMemoryCachingService      cachingService = new TestMemoryCachingService(TimeSpan.FromDays(1), false);
            Mock <ConfigurationCacheBase> cacheProxy     =
                new Mock <ConfigurationCacheBase>(useStrict ? MockBehavior.Strict : MockBehavior.Loose,
                                                  cachingService, jsonSerializer, TimeSpan.FromDays(1));

            return(cacheProxy);
        }
Exemple #3
0
        private static T GetService <T>(Func <ILoggingService, IApiKeyService, ICachingService, T> constructor, ICachingService cachingService = null)
            where T : AuthenticationService
        {
            ICachingService          memoryCachingService = cachingService ?? new TestMemoryCachingService(TimeSpan.FromMinutes(5));
            TestSerializationService serializationService = new TestSerializationService();
            TestCacheLoggingService  loggingService       = new TestCacheLoggingService(memoryCachingService, serializationService);
            BasicApiKeyService       apiKeyService        = new BasicApiKeyService(GetBackingKeys());
            T service = constructor(loggingService, apiKeyService, memoryCachingService);

            return(service);
        }