Beispiel #1
0
        public void TestBase()
        {
            var u = new RestUrl("http://www.hl7.org/svc");

            Assert.IsTrue(u.IsEndpointFor("http://www.hl7.org/svc/Organization"));
            Assert.IsTrue(u.IsEndpointFor("http://www.hl7.org/svc/Organization/search?name=eve"));
            Assert.IsFalse(u.IsEndpointFor("http://www.hl7.org/svx/Organization"));
        }
        private Uri tryCreatePatient(FhirClient client, ResourceFormat formatIn, string id = null)
        {
            client.PreferredFormat = formatIn;
            ResourceEntry <Patient> created = null;

            Patient demopat = DemoData.GetDemoPatient();

            if (id == null)
            {
                HttpTests.AssertSuccess(client, () => created = client.Create <Patient>(demopat));
            }
            else
            {
                HttpTests.AssertSuccess(client, () => created = client.Create <Patient>(demopat, id));

                var ep = new RestUrl(client.Endpoint);
                if (!ep.IsEndpointFor(created.Id))
                {
                    TestResult.Fail("Location of created resource is not located within server endpoint");
                }

                var rl = new ResourceIdentity(created.Id);
                if (rl.Id != id)
                {
                    TestResult.Fail("Server refused to honor client-assigned id");
                }
            }

            HttpTests.AssertLocationPresentAndValid(client);

            // Create bevat geen response content meer. Terecht verwijderd?:
            // EK: Niet helemaal, er is weliswaar geen data meer gereturned, maar de headers (id, versie, modified) worden
            // nog wel geupdate
            HttpTests.AssertContentLocationValidIfPresent(client);

            return(created.SelfLink);
        }