private IWebHost StartDependencyServiceHost(string fixerApiUrl, DependencyServiceStartupSetting dependencyServiceStartupSetting) { var host = new WebHostBuilder() .ConfigureServices(services => { services.AddSingleton(dependencyServiceStartupSetting); }) .UseKestrel() .UseUrls(fixerApiUrl) .UseStartup <DependencyServiceStartup>() .Build(); host.Start(); return(host); }
private void StartServer() { var fixerIoApiServiceStartupSetting = new DependencyServiceStartupSetting { ConfigureServices = s => s.AddSingleton <IFixerIOApiService>(c => FakeFixerIoApiService), ControllerTypes = new List <Type> { typeof(FixerIOAPIController) } }; var fixerIoUrl = $"http://localhost:{PortHelper.GetAvailablePort()}"; _fixerIoApiServiceHost = StartDependencyServiceHost(fixerIoUrl, fixerIoApiServiceStartupSetting); Url = $"http://localhost:{PortHelper.GetAvailablePort()}"; _server = StartMainHost(fixerIoUrl); HttpClient = new HttpClient { BaseAddress = new Uri(Url) }; }
public DependencyServiceStartup(DependencyServiceStartupSetting serviceSettings) { _serviceSettings = serviceSettings; }