public async Task InitializeAsync() { string environmentUrl = Environment.GetEnvironmentVariable($"TestEnvironmentUrl{Constants.TestEnvironmentVariableVersionSuffix}"); // Only set up test fixture if running against remote server if (!string.IsNullOrWhiteSpace(environmentUrl)) { var baseUrl = "https://localhost:" + Port; SmartLauncherUrl = baseUrl + "/index.html"; var builder = WebHost.CreateDefaultBuilder() .ConfigureAppConfiguration((hostingContext, config) => { config.AddInMemoryCollection(new Dictionary<string, string> { { "FhirServerUrl", environmentUrl }, { "ClientId", TestApplications.NativeClient.ClientId }, { "DefaultSmartAppUrl", "/sampleapp/launch.html" }, }); }) .UseStartup<SmartLauncher.Startup>() .UseUrls(baseUrl); WebServer = builder.Build(); WebServer.Start(); TestFhirServer testFhirServer = await _testFhirServerFactory.GetTestFhirServerAsync(DataStore.CosmosDb, null); TestFhirClient = testFhirServer.GetTestFhirClient(ResourceFormat.Json); } }
public TestFhirClient CreateClientForUser(TestUser user, TestApplication clientApplication) { EnsureArg.IsNotNull(user, nameof(user)); EnsureArg.IsNotNull(clientApplication, nameof(clientApplication)); return(_testFhirServer.GetTestFhirClient(Format, clientApplication, user)); }