示例#1
0
        public EsquioHttpStore(IHttpClientFactory httpClientFactory, IOptions <HttpStoreOptions> options, EsquioHttpStoreDiagnostics diagnostics, IDistributedCache cache = null)
        {
            _httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
            _            = options ?? throw new ArgumentNullException(nameof(options));
            _diagnostics = diagnostics ?? throw new ArgumentNullException(nameof(diagnostics));

            _cache   = cache;
            _options = options.Value;
        }
示例#2
0
        private EsquioHttpStore CreateStore(string apiKey)
        {
            var storeOptions = Options.Create(new HttpStoreOptions()
            {
                CacheEnabled = false,
                ApiKey       = apiKey,
                BaseAddress  = new Uri("http://localhost")
            });

            var diagnostics = new EsquioHttpStoreDiagnostics(new LoggerFactory());

            return(new EsquioHttpStore(
                       new TestServerHttpClientFactory(_fixture, apiKey),
                       storeOptions,
                       diagnostics));
        }
示例#3
0
        private EsquioHttpStore CreateCachedStore(IDistributedCache cache, string apiKey, bool useCache = true)
        {
            var storeOptions = Options.Create(new HttpStoreOptions()
            {
                CacheEnabled = useCache,
                ApiKey       = apiKey,
                BaseAddress  = new Uri("http://localhost")
            });

            var diagnostics = new EsquioHttpStoreDiagnostics(new LoggerFactory());

            return(new EsquioHttpStore(
                       new TestServerHttpClientFactory(_fixture, apiKey),
                       storeOptions,
                       diagnostics,
                       cache));
        }