Beispiel #1
0
        public void AddSearchEntry()
        {
            var testBundle = new Bundle();

            testBundle.AddSearchEntry(new Patient {
                Id = "5678"
            }, "http://server1.com/fhir/Patient/5678", Bundle.SearchEntryMode.Match);

            var firstEntry = testBundle.FindEntry("http://server1.com/fhir/Patient/5678").First();

            Assert.AreEqual(Bundle.SearchEntryMode.Match, firstEntry.Search.Mode);
            Assert.AreEqual("5678", firstEntry.Resource.Id);

            testBundle.AddSearchEntry(
                new Patient {
                Id = "5679"
            },
                "http://server1.com/fhir/Patient/5679",
                Bundle.SearchEntryMode.Include,
                new decimal(0.1));

            var secondEntry = testBundle.FindEntry("http://server1.com/fhir/Patient/5679").First();

            Assert.AreEqual(Bundle.SearchEntryMode.Include, secondEntry.Search.Mode);
            Assert.AreEqual("5679", secondEntry.Resource.Id);
            Assert.AreEqual((Decimal)0.1, secondEntry.Search.Score);

            // Retest that the first one can still be located
            firstEntry = testBundle.FindEntry("http://server1.com/fhir/Patient/5678").First();

            Assert.AreEqual(Bundle.SearchEntryMode.Match, firstEntry.Search.Mode);
            Assert.AreEqual("5678", firstEntry.Resource.Id);
        }