Beispiel #1
0
        public void CorrectFixedValue()
        {
            var    resource = FhirFile.LoadResource("TestData\\lipid.fixvalue.xml");
            Report report   = lipidSpec.Validate(resource);

            Assert.IsTrue(report.IsValid);
        }
Beispiel #2
0
        public void SlicingValid()
        {
            var    resource = FhirFile.LoadResource("TestData\\lipid.slice.valid.xml");
            Report report   = spec.Validate(resource);

            Assert.IsTrue(report.IsValid);
        }
        public void ValidResource()
        {
            var    resource = FhirFile.LoadResource("TestData\\Patient.Valid.xml");
            Report report   = spec.Validate(resource);
            var    errors   = report.Errors;

            Assert.IsTrue(report.IsValid);
        }
Beispiel #4
0
        public void Extensions()
        {
            Specification patientSpec = Factory.GetPatientExtendedSpec();
            var           resource    = FhirFile.LoadResource("TestData\\patient.extended.valid.xml");
            Report        report      = patientSpec.Validate(resource);

            Assert.IsTrue(report.IsValid);
        }
Beispiel #5
0
        public void Extensions()
        {
            Specification spec     = Factory.GetExtendedPatientSpec(expand: false, online: false);
            var           resource = FhirFile.LoadResource("TestData\\patient.extended.valid.xml");
            Report        report   = spec.Validate(resource);

            Assert.IsTrue(report.IsValid);
        }
        public void WrongRootElement()
        {
            var    resource = FhirFile.LoadResource("TestData\\invalidroot.xml");
            Report report   = spec.Validate(resource);

            Assert.IsFalse(report.IsValid);
            Assert.AreEqual(1, report.ErrorCount);
            Assert.IsTrue(report.Contains(Group.Structure, Status.Unknown));
        }
        public void CardinalityTooLittle()
        {
            var    resource = FhirFile.LoadResource("TestData\\Patient.CardinalityMinus.xml");
            Report report   = spec.Validate(resource);

            Assert.IsFalse(report.IsValid);
            Assert.IsTrue(report.Contains(Group.Cardinality, Status.Failed));
            Assert.AreEqual(1, report.ErrorCount);
        }
Beispiel #8
0
        public void IncorrectFixedValue()
        {
            var    resource = FhirFile.LoadResource("TestData\\lipid.fixvalue.wrong.xml");
            Report report   = lipidSpec.Validate(resource);

            Assert.IsFalse(report.IsValid);
            Assert.AreEqual(1, report.ErrorCount);
            Assert.IsTrue(report.Contains(Group.Value, Status.Failed));
        }
        public void ConstraintError()
        {
            var    resource = FhirFile.LoadResource("TestData\\Patient.ConstraintError.xml");
            Report report   = spec.Validate(resource);

            Assert.IsFalse(report.IsValid);
            Assert.AreEqual(1, report.ErrorCount);
            Assert.IsTrue(report.Contains(Group.Constraint, Status.Failed));
        }
Beispiel #10
0
        public void InvalidElement()
        {
            var    resource = FhirFile.LoadResource("TestData\\Patient.InvalidElement.xml");
            Report report   = patientSpec.Validate(resource);

            Assert.IsFalse(report.IsValid);
            Assert.AreEqual(1, report.ErrorCount);
            Assert.IsTrue(report.Contains(Group.Element, Status.Unknown));
        }
        public void Expanded()
        {
            var    resource = FhirFile.LoadResource("TestData\\lipid.profile.expanded.xml");
            Report report   = Validation.Validate(resource);

            var errors = report.Errors.ToList();

            Assert.IsTrue(report.IsValid);
        }
Beispiel #12
0
        public void SlicingInvalid()
        {
            var    resource = FhirFile.LoadResource("TestData\\lipid.slice.invalid.xml");
            Report report   = spec.Validate(resource);

            Assert.IsFalse(report.IsValid);
            Assert.AreEqual(4, report.ErrorCount);
            Assert.IsTrue(report.Contains(Group.Cardinality, Status.Failed));
            Assert.IsTrue(report.Contains(Group.Slice, Status.Failed));
        }
        public void Constraint()
        {
            // <constraint value="f:name or f:telecom or f:address or f:organization"/>
            var    resource = FhirFile.LoadResource("TestData\\Patient.ConstraintError.xml");
            Report report   = spec.Validate(resource);

            Assert.IsFalse(report.IsValid);
            Assert.AreEqual(1, report.ErrorCount);
            Assert.IsTrue(report.Contains(Group.Constraint, Status.Failed));
        }
Beispiel #14
0
        public SpecificationWorkspace Spec(string fileuri, string structure)
        {
            FhirFile.ExpandProfileFile("TestData\\" + fileuri + ".xml", "TestData\\testprofile.xml");
            Uri uri = new Uri("http://disk/testdata/testprofile.xml#" + structure);

            SpecificationProvider provider = SpecificationProvider.CreateOffline(new FileArtifactSource("TestData"));
            SpecificationBuilder  builder  = new SpecificationBuilder(provider);

            builder.Add(StructureFactory.PrimitiveTypes());
            builder.Add(StructureFactory.NonFhirNamespaces());
            builder.Add(uri);
            builder.Expand();

            return(builder.ToSpecification());
        }
        public void ValueSet_UnknownValue()
        {
            var    resource = FhirFile.LoadResource("TestData\\Patient.ErrorUse.xml");
            Report report   = spec.Validate(resource);

            // todo: bugfix ValueSet resolving
            // This validation should fail because the name use "unofficial" does not exist

            // However, the ProfileExpander/Resolver is not yet loading ValueSets, so ValueSet validation cannot take place.
            // As a result, the validation reports an unresolved error instead of a coding failed error.

            Assert.IsFalse(report.IsValid);
            Assert.IsTrue(report.Contains(Group.Coding, Status.Failed));
            Assert.AreEqual(1, report.ErrorCount);
        }
        public void NamespaceXHtml()
        {
            var    resource = FhirFile.LoadResource("TestData\\Patient.Narrative.correct.xml");
            Report report   = spec.Validate(resource);

            //report.Errors.ToConsole();

            Assert.IsTrue(report.IsValid);

            // In this narrative node, the div element does not contain a xhtml namespace and should not be found by the validator
            resource = FhirFile.LoadResource("TestData\\Patient.Narrative.wrong.xml");
            report   = spec.Validate(resource);
            //report.Errors.ToConsole();

            Assert.IsFalse(report.IsValid);
            Assert.IsTrue(report.Contains(Group.Cardinality, Status.Failed));
            Assert.AreEqual(1, report.ErrorCount);
        }
 protected override IEnumerable <Feed.Entry> Entries()
 {
     Feed.Entry entry = FhirFile.LoadXMLResource("Data\\profile.profile.xml");
     yield return(entry);
 }
Beispiel #18
0
 public XPathNavigator Load(string filename, string resource)
 {
     filename = string.Format("TestData\\{0}.xml", filename);
     return(FhirFile.LoadFeedResource(filename, resource));
 }
Beispiel #19
0
 protected Feed LoadResources(string filename)
 {
     return(FhirFile.LoadXMLFeed("Data\\" + filename + ".xml"));
 }
Beispiel #20
0
 protected override IEnumerable <Feed.Entry> Entries()
 {
     //Feed feed = LoadResources("lipid-profile");
     Feed.Entry entry = FhirFile.LoadXMLResource("Data\\lipid-profile.xml");
     yield return(entry);
 }