public void VReadVersions() { foreach (var ent in history.Entries.OfType <ResourceEntry>()) { var identity = new ResourceIdentity(ent.SelfLink); var version = client.Read <Patient>(identity); if (version == null) { TestResult.Fail("Cannot find version that was present in history"); } HttpTests.AssertContentLocationPresentAndValid(client); var selfLink = new ResourceIdentity(client.LastResponseDetails.ContentLocation); if (String.IsNullOrEmpty(selfLink.Id) || String.IsNullOrEmpty(selfLink.VersionId)) { TestResult.Fail("Optional Content-Location contains an invalid version-specific url"); } } foreach (var ent in history.Entries.OfType <DeletedEntry>()) { var identity = new ResourceIdentity(ent.SelfLink); HttpTests.AssertFail(client, () => client.Read <Patient>(identity), HttpStatusCode.Gone); } }
public void DeleteNonExistingPerson() { var rnd = new Random(); var location = "Patient/sprink" + rnd.Next().ToString(); HttpTests.AssertFail(client, () => client.Delete(location), HttpStatusCode.NotFound); }
public void HistoryForNonExistingResource() { if (CreateDate == null) { TestResult.Skip(); } HttpTests.AssertFail(client, () => client.History("Patient/3141592unlikely"), HttpStatusCode.NotFound); }
public void TryReadUnknownResourceType() { ResourceIdentity id = ResourceIdentity.Build(client.Endpoint, "thisreallywondexist", "1"); HttpTests.AssertFail(client, () => client.Read <Patient>(id), HttpStatusCode.NotFound); // todo: if the Content-Type header was not set by the server, this generates an abstract exception: // "The given key was not present in the dictionary"; }
public void DeleteBinary() { if (binaryId == null) { TestResult.Skip(); } client.Delete(binaryId); HttpTests.AssertFail(client, () => client.Read <Binary>(binaryId), HttpStatusCode.Gone); }
public void DeletePerson() { if (CreateDate == null) { TestResult.Skip(); } string location = "Patient/" + CrudId; client.Delete(location); HttpTests.AssertFail(client, () => client.Read <Patient>(location), HttpStatusCode.Gone); }
public void SearchPatientByMalformedParameter() { var nrOfAllPatients = client.Search <Patient>().Entries.Count(); Bundle actual = null; HttpTests.AssertFail <Bundle>(client, () => client.Search("Patient", new string[] { "...=test" }), out actual, HttpStatusCode.BadRequest); /* The statements below inspect the OperationOutcome in the result. But the FhirClient currently does not return any of the HttpStatusCode != OK. * var nrOfActualPatients = actual.Entries.ByResourceType<Patient>().Count(); * HttpTests.AssertCorrectNumberOfResults(0, nrOfActualPatients, "Expected no patients ({0}) since the only search parameter is invalid, but got {1}."); * TestResult.Assert(actual.Entries.ByResourceType<OperationOutcome>().Any(), "There should be an OperationOutcome."); */ }
public void TestTagsOnNonExisting() { // todo: tags from instance ResourceEntry nep = null; // non-existing-patient IEnumerable <Tag> tags = null; HttpTests.AssertFail(client, () => { nep = client.Read <Patient>("nonexisting"); }, HttpStatusCode.NotFound); TestResult.Assert(nep == null, "Non existing patient instance should be zero"); HttpTests.AssertFail(client, () => { tags = client.Tags <Patient>("nonexisting"); }, HttpStatusCode.NotFound); HttpTests.AssertFail(client, () => { tags = client.Tags <Patient>("nonexisting", "nonexisting"); }, HttpStatusCode.NotFound); }
public void TryReadBadFormattedResourceId() { //Test for Spark issue #7, https://github.com/furore-fhir/spark/issues/7 HttpTests.AssertFail(client, () => client.Read <Patient>("Patient/ID-may-not-contain-CAPITALS"), HttpStatusCode.BadRequest); }
public void TryReadNonExistingResource() { HttpTests.AssertFail(client, () => client.Read <Patient>("Patient/3141592unlikely"), HttpStatusCode.NotFound); }
public void TrySearchNonExistingResource() { HttpTests.AssertFail(client, () => client.Search("Nonexistingnonpatientresource"), HttpStatusCode.NotFound); }