コード例 #1
0
        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);
            }
        }
コード例 #2
0
 public FhirClient(
     HttpClient httpClient,
     TestFhirServer testFhirServer,
     ResourceFormat format,
     TestApplication clientApplication,
     TestUser user,
     (bool SecurityEnabled, string AuthorizeUrl, string TokenUrl) securitySettings)
コード例 #3
0
 public TestFhirClient(
     HttpClient httpClient,
     TestFhirServer testFhirServer,
     ResourceFormat format,
     TestApplication clientApplication,
     TestUser user)
     : base(httpClient, format)
 {
     _testFhirServer    = testFhirServer;
     _clientApplication = clientApplication;
     _user = user;
 }
コード例 #4
0
        public TestFhirClient(
            HttpClient httpClient,
            TestFhirServer testFhirServer,
            ResourceFormat format,
            TestApplication clientApplication,
            TestUser user)
            : base(httpClient, format)
        {
            _testFhirServer    = testFhirServer;
            _clientApplication = clientApplication;
            _user = user;

            ConfigureSecurityOptions().GetAwaiter().GetResult();
            SetupAuthenticationAsync(clientApplication, user).GetAwaiter().GetResult();
        }
コード例 #5
0
        public void Background()
        {
            "Given a running server".x(() => _server = new TestFhirServer(_outputHelper, "https://localhost:60001"));

            "and a FHIR client".x(
                () => _client = new FhirClient(
                    "https://localhost:60001/fhir",
                    new FhirClientSettings
            {
                CompressRequestBody       = true,
                ParserSettings            = ParserSettings.CreateDefault(),
                PreferCompressedResponses = true,
                PreferredFormat           = ResourceFormat.Json,
                UseFormatParameter        = false,
                VerifyFhirVersion         = false
            },
                    messageHandler: _server.Server.CreateHandler()));
        }