public void UpdateTagsOnVersionUsingPost() { var identity = new ResourceIdentity(latest.SelfLink); var update = new Tag(NUTAG, Tag.FHIRTAGSCHEME_GENERAL, "newVersionForVersion"); var existing = new Tag(_otherTag, Tag.FHIRTAGSCHEME_GENERAL); HttpTests.AssertSuccess(client, () => client.AffixTags(identity, new List <Tag> { update })); var result = client.Read <Patient>(latest.Id); if (result.Tags.Count() != 2) { TestResult.Fail("update modified the number of tags"); } if (!result.Tags.Any(t => t.Equals(existing))) { TestResult.Fail("update removed an existing but unchanged tag"); } if (!result.Tags.Any(t => t.Equals(update) && t.Label == update.Label)) { TestResult.Fail("update did not change the tag"); } if (result.SelfLink != latest.SelfLink) { TestResult.Fail("updating the tags created a new version"); } //TODO: Check whether taglists on older versions remain unchanged }
public void DeleteTagsOnVersionUsingDelete() { var identity = new ResourceIdentity(latest.SelfLink); var delete = new Tag(NUTAG, Tag.FHIRTAGSCHEME_GENERAL); var existing = new Tag(_otherTag, Tag.FHIRTAGSCHEME_GENERAL); HttpTests.AssertSuccess(client, () => client.DeleteTags(identity, new List <Tag> { delete })); var result = client.Read <Patient>(latest.Id); if (result.Tags.Count() != 1) { TestResult.Fail("delete resulted in an unexpected number of remaining tags"); } if (!result.Tags.Any(t => t.Equals(existing))) { TestResult.Fail("delete removed an existing tag the should be untouched"); } if (result.Tags.Any(t => t.Equals(delete))) { TestResult.Fail("delete did not remove the tag"); } if (result.SelfLink != latest.SelfLink) { TestResult.Fail("deleting the tags created a new version"); } //TODO: Check whether taglists on older versions remain unchanged }
public void SearchUsingTag() { var tag = new Tag(_otherTag, Tag.FHIRTAGSCHEME_GENERAL, "dummy"); Bundle result = null; HttpTests.AssertSuccess(client, () => result = client.Search <Patient>(new string[] { "_tag=" + _otherTag })); if (result.Entries.ByTag(_otherTag).Count() != 1) { TestResult.Fail("could not retrieve patient by its tag"); } }
public void TestTagsOnCreateAndRead() { var tags = new List <Tag>() { new Tag(NUTAG, Tag.FHIRTAGSCHEME_GENERAL, "readTagTest") }; var patient = DemoData.GetDemoPatient(); HttpTests.AssertSuccess(client, () => latest = client.Create(patient, tags, true)); if (latest.Tags == null) { TestResult.Fail("create did not return any tags"); } var nutags = latest.Tags.FindByTerm(NUTAG, Tag.FHIRTAGSCHEME_GENERAL); if (nutags.Count() != 1 || nutags.First().Label != "readTagTest") { TestResult.Fail("create did not return specified tag"); } var read = client.Read <Patient>(latest.Id); if (read.Tags == null) { TestResult.Fail("read did not return any tags"); } nutags = latest.Tags.FindByTerm(NUTAG, Tag.FHIRTAGSCHEME_GENERAL); if (nutags.Count() != 1 || nutags.First().Label != "readTagTest") { TestResult.Fail("read did not return specified tag"); } var vread = client.Read <Patient>(latest.SelfLink); if (vread.Tags == null) { TestResult.Fail("vread did not return any tags"); } nutags = latest.Tags.FindByTerm(NUTAG, Tag.FHIRTAGSCHEME_GENERAL); if (nutags.Count() != 1 || nutags.First().Label != "readTagTest") { TestResult.Fail("vread did not return specified tag"); } original = latest; }
public void GetServerWideTags() { IEnumerable <Tag> tags = null; HttpTests.AssertSuccess(client, () => tags = client.WholeSystemTags()); var tagStrings = tags.FilterOnFhirSchemes().Where(t => t.Term != null).Select(t => t.Term); if (!tagStrings.Contains(NUTAG) || !tagStrings.Contains(_otherTag)) { TestResult.Fail("expected tags not found in server-wide tag list"); } }
public void GetInstanceHistoryTags() { IEnumerable <Tag> tags = null; var rl = new ResourceIdentity(latest.SelfLink); HttpTests.AssertSuccess(client, () => tags = client.Tags <Patient>(rl.Id, rl.VersionId)); var tagStrings = tags.FilterOnFhirSchemes().Where(t => t.Term != null).Select(t => t.Term); if (!tagStrings.Contains(NUTAG) || !tagStrings.Contains(_otherTag)) { TestResult.Fail("expected tags not found in resource instance tag list"); } }
public void UpdateTagsOnUpdate() { if (original == null) { TestResult.Skip(); } // Update one tag, add another var newtags = new List <Tag>() { new Tag(NUTAG, Tag.FHIRTAGSCHEME_GENERAL, "readTagTest2"), new Tag(_otherTag, Tag.FHIRTAGSCHEME_GENERAL, "dummy") }; HttpTests.AssertSuccess(client, () => latest = client.Read <Patient>(original.Id)); latest.Tags = newtags; HttpTests.AssertSuccess(client, () => client.Update <Patient>(latest)); var read = client.Read <Patient>(latest.Id); if (read.Tags == null) { TestResult.Fail("fetch after update did not return any tags"); } if (read.Tags.Count() != 2) { TestResult.Fail(String.Format("Wrong number of tags after update: {0}, expected 2", read.Tags.Count())); } var nutags = read.Tags.FindByTerm(NUTAG, Tag.FHIRTAGSCHEME_GENERAL); if (nutags.Count() != 1 || nutags.First().Label != "readTagTest2") { TestResult.Fail("update did not replace value in tag"); } var othertags = read.Tags.FindByTerm(_otherTag, Tag.FHIRTAGSCHEME_GENERAL); if (othertags.Count() != 1 || othertags.First().Label != "dummy") { TestResult.Fail("update failed to add new tag"); } latest = read; }
public void GetResourceWideTags() { IEnumerable <Tag> tags = null; HttpTests.AssertSuccess(client, () => tags = client.TypeTags <Patient>()); var tagStrings = tags.FilterOnFhirSchemes().Where(t => t.Term != null).Select(t => t.Term); if (!tagStrings.Contains(NUTAG) || !tagStrings.Contains(_otherTag)) { TestResult.Fail("expected tags not found in resource-wide tag list"); } HttpTests.AssertSuccess(client, () => tags = client.TypeTags <Conformance>()); tagStrings = tags.FilterOnFhirSchemes().Where(t => t.Term != null).Select(t => t.Term); if (tagStrings.Contains(NUTAG) || tagStrings.Contains(_otherTag)) { TestResult.Fail("tags showed up while listing tags for another resource type"); } }
public void CreateBinary() { var bin = DemoData.GetDemoBinary(); ResourceEntry <Binary> received = null; HttpTests.AssertSuccess(client, () => received = client.Create <Binary>(bin)); HttpTests.AssertLocationPresentAndValid(client); var binResult = client.Read <Binary>(received.Id); if (binResult.Resource.ContentType != bin.ContentType) { TestResult.Fail("Created binary of type " + bin.ContentType + "but received " + client.LastResponseDetails.ContentType); } HttpTests.AssertContentLocationValidIfPresent(client); compareData(bin.Content, binResult); binaryId = received.Id; }
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); }