Example #1
0
        public virtual void TestFormatWithMissingConstraint()
        {
            Relationship rootConstraint = new Relationship();

            rootConstraint.Name       = "root";
            rootConstraint.FixedValue = "1.22.33.44";
            Relationship extConstraint = new Relationship();

            extConstraint.Name       = "extension";
            extConstraint.FixedValue = "1223344";
            ConstrainedDatatype constraints = new ConstrainedDatatype("iiConstraint", "II");

            constraints.Relationships.Add(rootConstraint);
            constraints.Relationships.Add(extConstraint);
            string result = new ListR2PropertyFormatter(this.formatterRegistry).Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                           (this.result, null, "ids", "LIST<II>", null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, Cardinality.Create
                                                                                               ("0-4"), false, SpecificationVersion.R02_04_03, null, null, null, constraints, false), (BareANY)LISTImpl <ANY <object>, object
                                                                                                                                                                                                         > .Create <II, Identifier>(typeof(IIImpl), CreateIdentifierList()));

            Assert.IsTrue(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            Assert.AreEqual(ErrorLevel.INFO, this.result.GetHl7Errors()[0].GetHl7ErrorLevel());
            Assert.AreEqual(Hl7ErrorCode.CDA_FIXED_CONSTRAINT_PROVIDED, this.result.GetHl7Errors()[0].GetHl7ErrorCode());
            Assert.AreEqual("A fixed constraint was added for compliance: root={1.22.33.44},extension={1223344}", this.result.GetHl7Errors
                                ()[0].GetMessage());
            AssertXml("non null", "<ids extension=\"123\" root=\"1.2.3\"/>" + "<ids extension=\"256\" root=\"2.5.6\"/>" + "<ids extension=\"1223344\" root=\"1.22.33.44\"/>"
                      , result);
        }
Example #2
0
        public virtual void TestFormatValueNull()
        {
            string result = new ListR2PropertyFormatter(this.formatterRegistry).Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                           (this.result, null, "ids", "LIST<II>", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, false), (BareANY) new
                                                                                       LISTImpl <II, Identifier>(typeof(IIImpl)));

            Assert.IsTrue(this.result.IsValid());
            Assert.AreEqual(0, this.result.GetHl7Errors().Count);
            AssertXml("null", string.Empty, result);
        }
Example #3
0
        public virtual void TestFormatValueNonNull()
        {
            string result = new ListR2PropertyFormatter(this.formatterRegistry).Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                           (this.result, null, "ids", "LIST<II>", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, Cardinality.Create("0-4"
                                                                                                                                                                                                              ), false, SpecificationVersion.R02_04_03, null, null, null, false), (BareANY)LISTImpl <ANY <object>, object> .Create <II, Identifier
                                                                                                                                                                                                                                                                                                                                    >(typeof(IIImpl), CreateIdentifierList()));

            Assert.IsTrue(this.result.IsValid());
            Assert.AreEqual(0, this.result.GetHl7Errors().Count);
            AssertXml("non null", "<ids extension=\"123\" root=\"1.2.3\"/>" + "<ids extension=\"256\" root=\"2.5.6\"/>", result);
        }