internal static IHost GivenServer(
     this FeatsEvaluationClientTests tests,
     string url,
     bool featureIsOn)
 {
     return(Host
            .CreateDefaultBuilder(null)
            .ConfigureWebHostDefaults(webBuilder =>
     {
         webBuilder
         .ConfigureServices(services =>
         {
             services.AddHttpClient();
         })
         .Configure(app =>
         {
             app.UseRouting();
             app.UseEndpoints(endpoints =>
             {
                 endpoints.MapGet("/features", async context =>
                 {
                     context.Request.Headers.Keys.Should().Contain("Accept");
                     context.Request.Headers.Keys.Should().Contain(StrategySettings.GreaterThan);
                     await context.Response.WriteAsync(JsonSerializer.Serialize(featureIsOn));
                 });
             });
         });
         webBuilder.UseUrls(url);
     })
            .Build());
 }
 internal static IFeatsEvaluationClient GivenClient(
     this FeatsEvaluationClientTests tests,
     IFeatsEvaluationConfiguration configuration,
     IEvaluationCache cache,
     IHttpClientFactory httpClientFactory)
 {
     return(new FeatsEvaluationClient(
                configuration,
                new TestLogger <FeatsEvaluationClient>(),
                httpClientFactory,
                cache));
 }
        internal static Mock <IFeatsEvaluationConfiguration> GivenConfiguration(
            this FeatsEvaluationClientTests tests,
            string url)
        {
            var builder = new UriBuilder(url);
            var uri     = builder.Uri;

            var mock = new Mock <IFeatsEvaluationConfiguration>();

            mock
            .Setup(_ => _.Host)
            .Returns(uri);
            mock
            .Setup(_ => _.RequestTimeout)
            .Returns(1.Seconds());

            return(mock);
        }
 internal static IEvaluationCache GivenNoCache(
     this FeatsEvaluationClientTests tests)
 {
     return(new TestNoCacheEvaluationCache());
 }
 internal static IEvaluationCache GivenCache(
     this FeatsEvaluationClientTests tests,
     bool value)
 {
     return(new TestCacheEvaluationCache(value));
 }