コード例 #1
0
        public void BundleEntryByReference()
        {
            Bundle b = new Bundle();

            b.Entries.Add(new ResourceEntry<Patient> { Id = new Uri("http://x.com/Patient/1"), SelfLink = new Uri("http://x.com/Patient/1/_history/1") });
            b.Entries.Add(new ResourceEntry<Patient> { Id = new Uri("http://x.com/Patient/1"), SelfLink = new Uri("http://x.com/Patient/1/_history/2") });
            b.Entries.Add(new ResourceEntry<Patient> { Id = new Uri("http://y.com/Patient/1"), SelfLink = new Uri("http://y.com/Patient/1") });

            b.Links.Base = new Uri("http://x.com");

            Assert.AreEqual(2, b.FindEntryByReference(new Uri("Patient/1", UriKind.Relative)).Count());
            Assert.AreEqual(1, b.FindEntryByReference(new Uri("Patient/1/_history/1", UriKind.Relative)).Count());
            Assert.AreEqual(2, b.FindEntryByReference(new Uri("http://y.com/Patient/1")).Count());
        }