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

            var prof = locator.LocateStructure(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.LocateStructure(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.LocateStructure(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.LocateStructure(profileUriWithFrag, new Code("Profile"));
            Assert.IsNull(prof);
        }
Ejemplo n.º 2
0
        public void TestExpandChild()
        {
            var loader     = new StructureLoader(ArtifactResolver.CreateDefault());
            var profStruct = loader.LocateStructure(new Uri("http://hl7.org/fhir/Profile/Profile"), new Code("Profile"));

            var nav = new ElementNavigator(profStruct.Snapshot);

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

            nav.JumpToFirst("Profile.structure.differential");
            Assert.IsTrue(nav.ExpandElement(loader));
            Assert.IsTrue(nav.MoveToChild("element"));
        }
Ejemplo n.º 3
0
 private T Resolve <T>(Uri uri) where T : Model.Resource
 {
     loader.LocateStructure(uri);
     Model.Resource resource = source.ReadResourceArtifact(uri);
     return((T)resource);
 }