当前位置: 首页>>代码示例>>C#>>正文


C# Bundle.AddResourceEntry方法代码示例

本文整理汇总了C#中Hl7.Fhir.Model.Bundle.AddResourceEntry方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.AddResourceEntry方法的具体用法?C# Bundle.AddResourceEntry怎么用?C# Bundle.AddResourceEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hl7.Fhir.Model.Bundle的用法示例。


在下文中一共展示了Bundle.AddResourceEntry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResourceListFiltering

        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());
        }
开发者ID:012345789,项目名称:fhir-net-api,代码行数:29,代码来源:BundleExtensionsTest.cs

示例2: TestFindEntry

        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());
        }
开发者ID:012345789,项目名称:fhir-net-api,代码行数:17,代码来源:BundleExtensionsTest.cs

示例3: TestBundleSummary

        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"));
        }
开发者ID:tiloc,项目名称:fhir-net-api,代码行数:20,代码来源:SerializationTests.cs


注:本文中的Hl7.Fhir.Model.Bundle.AddResourceEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。