public static CrucibleClient CreateClient()
        {
            if (string.IsNullOrEmpty(CrucibleEnvironmentUrl) || string.IsNullOrEmpty(TestEnvironmentUrl))
            {
                return(null);
            }

            var client = new CrucibleClient();

            client.SetTestServerAsync(CrucibleEnvironmentUrl, TestEnvironmentUrl, TestEnvironmentName).GetAwaiter().GetResult();

            return(client);
        }
예제 #2
0
        public static async Task <string[]> GetSupportedIdsAsync(CrucibleClient client)
        {
            await client.RefreshConformanceStatementAsync();

            using (var testFhirServerFactory = new TestFhirServerFactory())
            {
                var fhirClient = testFhirServerFactory
                                 .GetTestFhirServer(_dataStore, null)
                                 .GetFhirClient(ResourceFormat.Json);

                if (fhirClient.SecuritySettings.SecurityEnabled)
                {
                    await client.AuthorizeServerAsync(fhirClient.SecuritySettings.AuthorizeUrl, fhirClient.SecuritySettings.TokenUrl);
                }

                var supportedTests = await client.GetSupportedTestsAsync();

                var ids = supportedTests.Where(x => x.Supported).Select(x => x.Id).ToArray();

                return(ids);
            }
        }
예제 #3
0
        public static async Task <string[]> GetSupportedIdsAsync(CrucibleClient client)
        {
            await client.RefreshConformanceStatementAsync();

            var httpClient = new HttpClient
            {
                BaseAddress = new Uri(TestEnvironmentUrl),
            };

            var fhirClient = new FhirClient(httpClient, ResourceFormat.Json);

            if (fhirClient.SecuritySettings.SecurityEnabled)
            {
                await client.AuthorizeServerAsync(fhirClient.SecuritySettings.AuthorizeUrl, fhirClient.SecuritySettings.TokenUrl);
            }

            var supportedTests = await client.GetSupportedTestsAsync();

            var ids = supportedTests.Where(x => x.Supported).Select(x => x.Id).ToArray();

            return(ids);
        }
        public static async Task <string[]> GetSupportedIdsAsync(CrucibleClient client)
        {
            await client.RefreshConformanceStatementAsync();

            await using (var testFhirServerFactory = new TestFhirServerFactory())
            {
                var testFhirServer = await testFhirServerFactory
                                     .GetTestFhirServerAsync(_dataStore, null);

                // Obtaining a client is required for configuring the security options.
                testFhirServer.GetTestFhirClient(ResourceFormat.Json, reusable: false);

                if (testFhirServer.SecurityEnabled)
                {
                    await client.AuthorizeServerAsync(testFhirServer.AuthorizeUri, testFhirServer.TokenUri);
                }

                var supportedTests = await client.GetSupportedTestsAsync();

                var ids = supportedTests.Where(x => x.Supported).Select(x => x.Id).ToArray();

                return(ids);
            }
        }