public void LocateStructure()
        {
            var locator    = new StructureLoader(ArtifactResolver.CreateDefault());
            var profileUri = new Uri("http://hl7.org/fhir/Profile/Profile");

            var prof = locator.Locate(profileUri, new Code("Profile"));

            Assert.IsNotNull(prof);
            Assert.AreEqual("Profile", prof.Type);
            //Assert.AreEqual(profileUri.ToString(), prof.GetProfileLocation());

            // Try to locate a structure that cannot be found in the given profile
            prof = locator.Locate(profileUri, new Code("Patient"));
            Assert.IsNull(prof);

            profileUri = new Uri("http://take.from.disk/Profile/example-lipid-profile");
            var profileUriWithFrag = new Uri(profileUri.ToString() + "#lipidResultMessage");

            prof = locator.Locate(profileUriWithFrag, new Code("MessageHeader"));
            Assert.IsNotNull(prof);
            Assert.AreEqual("MessageHeader", prof.Type);
            Assert.AreEqual("lipidResultMessage", prof.Name);
            //Assert.AreEqual(profileUri.ToString(), prof.GetProfileLocation());

            // Try to locate a structure that cannot be found in the profile by name
            profileUriWithFrag = new Uri(profileUri.ToString() + "#XXX");
            prof = locator.Locate(profileUriWithFrag, new Code("Profile"));
            Assert.IsNull(prof);
        }
        public void TestExpandChild()
        {
            var loader     = new StructureLoader(ArtifactResolver.CreateDefault());
            var profStruct = loader.Locate(new Uri("http://hl7.org/fhir/Profile/Profile"), new Code("Profile"));

            var nav = new ElementNavigator(profStruct);

            nav.JumpToFirst("Profile.telecom");
            Assert.IsTrue(nav.ExpandElement(loader));
            Assert.IsTrue(nav.MoveToChild("period"));

            nav.JumpToFirst("Profile.extensionDefn.definition");
            Assert.IsTrue(nav.ExpandElement(loader));
            Assert.IsTrue(nav.MoveToChild("max"));
        }
示例#3
0
 private T Resolve <T>(Uri uri) where T : Model.Resource
 {
     loader.Locate(uri);
     Model.Resource resource = source.ReadResourceArtifact(uri);
     return((T)resource);
 }