Beispiel #1
0
        public async Task CanCreatePatientWithDifferentFormats(ResourceFormat format)
        {
            var client = new FhirClient(
                "https://localhost:60001/fhir",
                new FhirClientSettings
            {
                CompressRequestBody       = true,
                ParserSettings            = ParserSettings.CreateDefault(),
                PreferCompressedResponses = true,
                PreferredFormat           = format,
                UseFormatParameter        = false,
                VerifyFhirVersion         = false
            },
                messageHandler: _server.Server.CreateHandler());
            var patient = new Patient
            {
                Active = true,
                Name   = { new HumanName {
                               Family = "Tester", Use = HumanName.NameUse.Usual
                           } }
            };

            var result = await client.CreateAsync(patient).ConfigureAwait(false);

            Assert.NotNull(result.Id);
        }
Beispiel #2
0
 public Requester(Uri baseUrl)
 {
     BaseUrl            = baseUrl;
     UseFormatParameter = false;
     PreferredFormat    = ResourceFormat.Xml;
     Timeout            = 100 * 1000; // Default timeout is 100 seconds
     Prefer             = Rest.Prefer.ReturnRepresentation;
     ParserSettings     = ParserSettings.CreateDefault();
 }
Beispiel #3
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()));
        }
Beispiel #4
0
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddControllers();
     services.AddLogging(l => l.AddXunit(_outputHelper));
     services.AddFhir(
         new SparkSettings
     {
         UseAsynchronousIO  = true,
         Endpoint           = new Uri("https://localhost:60001/fhir"),
         FhirRelease        = "R4",
         ParserSettings     = ParserSettings.CreateDefault(),
         SerializerSettings = SerializerSettings.CreateDefault()
     });
     services.AddSingleton <IFhirIndex, InMemoryFhirIndex>();
     services.AddSingleton <ISnapshotStore, InMemorySnapshotStore>();
     services.AddSingleton <IHistoryStore, InMemoryHistoryStore>();
     services.AddSingleton <IGenerator, GuidGenerator>();
     services.AddSingleton <IFhirStore, InMemoryFhirStore>();
     services.AddSingleton <IIndexStore, NoopIndexStore>();
     services.AddSingleton <IPatchService, PatchService>();
 }