Exemple #1
0
        public virtual void TestParseFull()
        {
            XmlNode node = CreateNode("<something code=\"BARNEY\" codeSystem=\"1.2.3.4.5\" codeSystemName=\"aCsName\" codeSystemVersion=\"aCsVersion\" displayName=\"aDisplayName\" value=\"1.2\" operator=\"P\">"
                                      + "  some freeform text" + "  <originalText>some original text</originalText>" + "  <qualifier inverted=\"true\"><name code=\"cm\" codeSystem=\"1.2.3.4\"/><value code=\"normal\" codeSystem=\"2.16.840.1.113883.5.14\"/></qualifier>"
                                      + "  <qualifier inverted=\"true\"><name code=\"M\" codeSystem=\"2.16.840.1.113883.5.1\"/><value code=\"ACT\" codeSystem=\"2.16.840.1.113883.5.6\"/></qualifier>"
                                      + "  <translation code=\"M\" codeSystem=\"2.16.840.1.113883.5.1\" />" + "  <translation code=\"F\" codeSystem=\"2.16.840.1.113883.5.1\" />"
                                      + "</something>");
            SC_R2 <MockCharacters> sc = (SC_R2 <MockCharacters>) this.parser.Parse(ParseContextImpl.Create("SC", typeof(MockCharacters),
                                                                                                           SpecificationVersion.V02R02, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, null, false), node
                                                                                   , this.xmlResult);

            Assert.IsFalse(this.xmlResult.IsValid());
            Assert.AreEqual(5, this.xmlResult.GetHl7Errors().Count, "error message count");
            Assert.IsNotNull(sc.Value, "main enum found");
            Assert.AreEqual("BARNEY", sc.Value.GetCodeValue(), "main code");
            Assert.AreEqual("1.2.3.4.5", sc.Value.GetCodeSystem(), "main code");
            Assert.AreEqual("aCsName", sc.Value.CodeSystemName);
            Assert.AreEqual("aCsVersion", sc.Value.CodeSystemVersion);
            Assert.AreEqual("aDisplayName", sc.Value.DisplayName);
            Assert.IsNull(sc.Value.Operator);
            Assert.IsNull(sc.Value.Value);
            Assert.AreEqual("some freeform text", sc.Value.SimpleValue);
            Assert.IsNull(sc.Value.OriginalText);
            Assert.AreEqual(0, sc.Value.Translation.Count);
            Assert.AreEqual(0, sc.Value.Qualifier.Count);
        }
Exemple #2
0
 public AuthoringDevice()
 {
     this.typeId                = new IIImpl();
     this.templateId            = new LISTImpl <II, Identifier>(typeof(IIImpl));
     this.code                  = new CE_R2Impl <Code>();
     this.manufacturerModelName = new SC_R2Impl <Code>();
     this.softwareName          = new SC_R2Impl <Code>();
     this.asMaintainedEntity    = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Basemodel.MaintainedEntity>();
 }
Exemple #3
0
 public Device()
 {
     this.classCode             = new CS_R2Impl <EntityClassDevice>();
     this.typeId                = new IIImpl();
     this.templateId            = new LISTImpl <II, Identifier>(typeof(IIImpl));
     this.code                  = new CE_R2Impl <Code>();
     this.manufacturerModelName = new SC_R2Impl <Code>();
     this.softwareName          = new SC_R2Impl <Code>();
 }
Exemple #4
0
        public virtual void TestParseNoCodeAttributeNode()
        {
            XmlNode node = CreateNode("<something notvalue=\"\" />");
            SC_R2 <MockCharacters> sc = (SC_R2 <MockCharacters>) this.parser.Parse(ParseContextImpl.Create("SC", typeof(MockCharacters),
                                                                                                           SpecificationVersion.V02R02, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, null, false), node
                                                                                   , this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.IsNull(sc.Value, "node with no code attribute returns null");
        }
Exemple #5
0
        public virtual void TestParseEmptyNode()
        {
            XmlNode node = CreateNode("<something/>");
            SC_R2 <MockCharacters> sc = (SC_R2 <MockCharacters>) this.parser.Parse(ParseContextImpl.Create("SC", typeof(MockCharacters),
                                                                                                           SpecificationVersion.V02R02, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, null, null, false), node
                                                                                   , this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.IsNull(sc.Value, "empty node returns null");
        }
Exemple #6
0
        public virtual void TestParseCodeWithNullNodeAndCodeSystem()
        {
            XmlNode node = CreateNode("<something code=\"BARNEY\" codeSystem=\"1.2.3.4.5\" nullFlavor=\"OTH\"/>");
            SC_R2 <MockCharacters> sc = (SC_R2 <MockCharacters>) this.parser.Parse(ParseContextImpl.Create("SC", typeof(MockCharacters),
                                                                                                           SpecificationVersion.V02R02, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, null, false), node
                                                                                   , this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.AreEqual("BARNEY", sc.Value.GetCodeValue(), "value");
            Assert.AreEqual(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.OTHER, sc.NullFlavor, "null flavor");
        }
Exemple #7
0
        public virtual void TestParseNullNode()
        {
            XmlNode node = CreateNode("<something nullFlavor=\"NI\"/>");
            SC_R2 <MockCharacters> sc = (SC_R2 <MockCharacters>) this.parser.Parse(ParseContextImpl.Create("SC", typeof(MockCharacters),
                                                                                                           SpecificationVersion.V02R02, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, null, false), node
                                                                                   , this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.IsNull(sc.Value, "value");
            Assert.AreEqual(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION, sc.NullFlavor, "null flavor");
        }
Exemple #8
0
        public virtual void TestParseValidWithInvalidNullFavorAttributeValue()
        {
            XmlNode node = CreateNode("<something code=\"BARNEY\" nullFlavor=\"NOT A VALID NULL FAVOR VALUE\"/>");
            SC_R2 <MockCharacters> sc = (SC_R2 <MockCharacters>) this.parser.Parse(ParseContextImpl.Create("SC", typeof(MockCharacters),
                                                                                                           SpecificationVersion.V02R02, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, null, false), node
                                                                                   , this.xmlResult);

            Assert.IsFalse(this.xmlResult.IsValid());
            Assert.AreEqual(1, this.xmlResult.GetHl7Errors().Count);
            Assert.AreEqual("BARNEY", sc.Value.GetCodeValue(), "node with no code attribute returns null");
        }
Exemple #9
0
        public virtual void TestParseValidFull()
        {
            XmlNode node = CreateNode("<something code=\"FRED\" codeSystem=\"1.2.3.4.5\" codeSystemName=\"aCsName\" codeSystemVersion=\"aCsVersion\" displayName=\"aDisplayName\">"
                                      + " some text goes here" + "</something>");
            SC_R2 <MockCharacters> sc = (SC_R2 <MockCharacters>) this.parser.Parse(ParseContextImpl.Create("SC", typeof(MockCharacters),
                                                                                                           SpecificationVersion.V02R02, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, null, false), node
                                                                                   , this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid(), "valid");
            Assert.AreEqual(MockEnum.FRED, sc.Value.Code, "enum found properly");
            Assert.AreEqual("aCsName", sc.Value.CodeSystemName);
            Assert.AreEqual("aCsVersion", sc.Value.CodeSystemVersion);
            Assert.AreEqual("aDisplayName", sc.Value.DisplayName);
            Assert.AreEqual("some text goes here", sc.Value.SimpleValue);
        }