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(
     Action <IHttpClientBuilder> addTokenHandler,
     TokenEndpointHandler tokenEndpointHandler = null,
     bool addCaching = false,
     DownstreamApiHandler downstreamApi = null)
 => CreateServer(tokenEndpointHandler, addCaching, new DownstreamApi(DefaultDownstreamApi, downstreamApi ?? new DownstreamApiHandler(), addTokenHandler));
 public DownstreamApi(string name, DownstreamApiHandler handler, Action <IHttpClientBuilder> addTokenHandler)
 {
     Name            = name ?? throw new ArgumentNullException(nameof(name));
     Handler         = handler ?? throw new ArgumentNullException(nameof(handler));
     AddTokenHandler = addTokenHandler ?? throw new ArgumentNullException(nameof(addTokenHandler));
 }