public static HttpClient CreateClient(
     Action <IHttpClientBuilder> addTokenHandler,
     TokenEndpointHandler tokenEndpointHandler = null,
     bool addCaching = false,
     DownstreamApiHandler downstreamApi = null)
 => CreateServer(addTokenHandler, tokenEndpointHandler, addCaching, downstreamApi)
 .CreateClient();
 public static IServiceProvider CreateHost(
     Action <IHttpClientBuilder> addTokenHandler,
     TokenEndpointHandler tokenEndpointHandler = null,
     bool addCaching          = false,
     DownstreamApiHandler api = null)
 => CreateHost(
     tokenEndpointHandler,
     addCaching,
     new DownstreamApi(DefaultApi, api ?? new DownstreamApiHandler(), addTokenHandler));
 public static TestServer CreateServer(
     TokenEndpointHandler tokenEndpointHandler = null,
     bool addCaching = false,
     params DownstreamApi[] downstreamApis)
 => CreateServer(
     services =>
 {
     if (tokenEndpointHandler != null)
     {
         services
         .AddHttpClient(TokenHandlerOptions.DefaultAuthorityHttpClientName)
         .AddHttpMessageHandler(() => tokenEndpointHandler);
     }
 },
     addCaching,
     downstreamApis);
 public static IServiceProvider CreateHost(
     TokenEndpointHandler tokenEndpointHandler = null,
     bool addCaching = false,
     params DownstreamApi[] apis)
 {
     return(CreateHost(
                services =>
     {
         if (tokenEndpointHandler != null)
         {
             services
             .AddHttpClient(TokenHandlerOptions.DefaultAuthorityHttpClientName)
             .AddHttpMessageHandler(() => tokenEndpointHandler);
         }
     },
                addCaching,
                apis));
 }
 public static TestServer CreateServer(
     Action <IHttpClientBuilder> addTokenHandler,
     TokenEndpointHandler tokenEndpointHandler = null,
     bool addCaching = false,
     DownstreamApiHandler downstreamApi = null)
 => CreateServer(tokenEndpointHandler, addCaching, new DownstreamApi(DefaultDownstreamApi, downstreamApi ?? new DownstreamApiHandler(), addTokenHandler));