private static List <Task <long> > CreateProxyTasks(IServiceProxyClient <IDog> dogProxyClient, Dictionary <string, string> headers, int count) { var globalInterceptors = CreateGlobalInterceptors(); var proxyCallTasks = new List <Task <long> >(); for (int i = 0; i < count; i++) { proxyCallTasks.Add(ExecuteProxyClient(dogProxyClient, headers, globalInterceptors)); } return(proxyCallTasks); }
private static Task <long> ExecuteProxyClient(IServiceProxyClient <IDog> dogProxyClient, Dictionary <string, string> headers, IOrderedEnumerable <IProxyInterceptor> globalInterceptors) { return(Task.Run(async() => { var dog = dogProxyClient.GetService(headers, globalInterceptors); Stopwatch st = new Stopwatch(); st.Start(); var name = await dog.Bark(new DogService.Models.BarkRequest { Name = "thor" }); st.Stop(); return st.ElapsedMilliseconds; })); }
private static void Preconditions(out IServiceProxyClient <IDog> dogProxyClient, out Dictionary <string, string> headers) { var collection = new ServiceCollection() .AddScoped <ISerializer, JsonNetSerializer>() .AddScoped((IServiceProvider p) => { return(new ServiceInformation <IDog> { BaseUrl = "https://localhost:5001/api/", Ttl = TimeSpan.FromSeconds(30) }); }) .AddSimpleProxyClient <IDog>() .BuildServiceProvider(); dogProxyClient = collection.GetService <IServiceProxyClient <IDog> >(); headers = new Dictionary <string, string> { { "color", "blue" } }; }
public LoginController(IServiceProxyClient proxy) { this.proxy = proxy; }