public void ResourceListFiltering() { var testBundle = new Bundle(); testBundle.AddResourceEntry(new Patient { Id = "1234", Meta = new Meta { VersionId = "v2" } }, "http://nu.nl/fhir/Patient/1234"); testBundle.AddResourceEntry(new Patient { Id = "1234", Meta = new Meta { VersionId = "v3" } }, "http://nu.nl/fhir/Patient/1234"); testBundle.AddResourceEntry(new Patient { Id = "1234", Meta = new Meta { VersionId = "v4" } }, "http://nu.nl/fhir/Patient/1234") .Request = new Bundle.BundleEntryRequestComponent { Method = Bundle.HTTPVerb.DELETE } ; testBundle.AddResourceEntry(new Patient { Id = "5678" }, "http://server1.com/fhir/Patient/5678"); testBundle.AddResourceEntry(new Patient { Id = "1.2.3.4.5" }, "urn:oid:1.2.3.4.5"); var result = testBundle.FindEntry("http://nu.nl/fhir/Patient/1234"); Assert.AreEqual(2, result.Count()); result = testBundle.FindEntry("http://nu.nl/fhir/Patient/1234", includeDeleted: true); Assert.AreEqual(3, result.Count()); result = testBundle.FindEntry("http://nu.nl/fhir/Patient/1234/_history/v3", includeDeleted: true); Assert.AreEqual(1, result.Count()); result = testBundle.FindEntry(new Uri("http://server3.org/fhir/Patient/1234")); Assert.AreEqual(0, result.Count()); result = testBundle.FindEntry(new Uri("http://server1.com/fhir/Patient/5678")); Assert.AreEqual(1, result.Count()); result = testBundle.FindEntry(new Uri("http://server2.com/fhir/Patient/5678")); Assert.AreEqual(0, result.Count()); result = testBundle.FindEntry(new Uri("urn:oid:1.2.3.4.5")); Assert.AreEqual(1, result.Count()); }
public void TestFindEntry() { Bundle b = new Bundle(); b.AddResourceEntry(new Patient { Id = "4" }, "http://some.org/fhir/Patient/4"); b.AddResourceEntry(new Patient { Id = "5", Meta = new Meta { VersionId = "5" } }, "http://some.org/fhir/Patient/5"); b.AddResourceEntry(new Patient { Id = "6" }, "http://some.org/fhir/Patient/8"); Assert.AreEqual(1, b.FindEntry("http://some.org/fhir/Patient/4").Count()); Assert.AreEqual(1, b.FindEntry("http://some.org/fhir/Patient/5").Count()); Assert.AreEqual(0, b.FindEntry("http://some.org/fhir/Patient/6").Count()); Assert.AreEqual(1, b.FindEntry("http://some.org/fhir/Patient/8").Count()); Assert.AreEqual(1, b.FindEntry("http://some.org/fhir/Patient/5/_history/5").Count()); Assert.AreEqual(0, b.FindEntry("http://some.org/fhir/Patient/5/_history/6").Count()); Assert.AreEqual(1, b.FindEntry("https://some.org/fhir/Patient/4").Count()); }
public void TestBundleSummary() { var p = new Patient(); p.BirthDate = "1972-11-30"; // present in both summary and full p.Photo = new List<Attachment>() { new Attachment() { ContentType = "text/plain" } }; var b = new Bundle(); b.AddResourceEntry(p, "http://nu.nl/fhir/Patient/1"); var full = FhirSerializer.SerializeResourceToXml(b); Assert.IsTrue(full.Contains("<entry")); Assert.IsTrue(full.Contains("<birthDate")); Assert.IsTrue(full.Contains("<photo")); var summ = FhirSerializer.SerializeResourceToXml(b, summary: true); Assert.IsTrue(summ.Contains("<entry")); Assert.IsTrue(summ.Contains("<birthDate")); Assert.IsFalse(summ.Contains("<photo")); }