private HttpClient CreateServerInstanceAndClient(int index) { var server = StartServer(); var wrappedServer = new RequestLogger(output, options.VerboseLogging, server, true); return new HttpClient(wrappedServer) {BaseAddress = new Uri($"http://backend-server-{index + 1}")}; }
private ShoppingClient CreateClient(ITestOutputHelper output, HttpServer server, bool traceResponses) { var baseUri = new Uri("http://testing"); var config = new ShoppingClientConfig(baseUri, traceResponses, output.WriteLine); HttpMessageHandler handlerPipeline = new RequestLogger(output, options.VerboseLogging, server); return new ShoppingClient(config, handlerPipeline); }
protected LoadBalancedTest(ITestOutputHelper output, Options options) : base(output, options) { this.output = output; this.options = options; var baseUri = new Uri("http://shopping.com"); var config = new ShoppingClientConfig(baseUri, true, output.WriteLine); var loadBalancer = new LoadBalancer(baseUri, 3, CreateServerInstanceAndClient, output); var requestLogger = new RequestLogger(output, true, loadBalancer, true); Client = new ShoppingClient(config, requestLogger); }