public TestContext(WebApplicationFactory <Startup> factory) { _webFactory = factory; _testSupportConfigurationOptions = GetTestSupportConfigurationOptions(); MockServer = SetupMockedServer(); HttpClient = SetupApiClient(); }
private TestSupportOptions GetTestSupportConfigurationOptions() { TestSupportOptions options = new TestSupportOptions(); IConfigurationRoot config = new ConfigurationBuilder() .SetBasePath(AppContext.BaseDirectory) .AddJsonFile("appsettings.json", false, true) .Build(); config.GetSection(nameof(TestSupportOptions)).Bind(options); if (string.IsNullOrEmpty(options.ApiClientUrl) || string.IsNullOrEmpty(options.ServerMockUrl)) { throw new ConfigurationErrorsException($"Invalid configuration in appsettings json file"); } return(options); }