コード例 #1
0
        public virtual void TestParseWithMaximumViolation()
        {
            XmlNode node = CreateNode("<top><telecom specializationType=\"TEL.PHONE\" value=\"tel:+1-519-555-2345;ext=1\"/>" + "<telecom specializationType=\"TEL.PHONE\" value=\"tel:+1-519-555-2345;ext=2\"/>"
                                      + "<telecom specializationType=\"TEL.PHONE\" value=\"tel:+1-519-555-2345;ext=3\"/>" + "<telecom specializationType=\"TEL.PHONE\" value=\"tel:+1-416-555-2345;ext=4\"/></top>"
                                      );
            BareANY result = new ListElementParser(this.parserRegistry).Parse(ParseContextImpl.Create("LIST<TEL.PHONEMAIL>", null, SpecificationVersion
                                                                                                      .V02R02, null, null, null, Cardinality.Create("1-2"), null, false), AsList(node.ChildNodes), this.xmlResult);

            Assert.IsFalse(this.xmlResult.IsValid());
            Assert.AreEqual(1, this.xmlResult.GetHl7Errors().Count);
            Assert.AreEqual("Number of elements (4) is more than the specified maximum (2)", this.xmlResult.GetHl7Errors()[0].GetMessage
                                ());
            IList <TelecommunicationAddress> list = ((LIST <TEL, TelecommunicationAddress>)result).RawList();

            Assert.IsNotNull(list, "null");
            Assert.AreEqual(4, list.Count, "size");
            TelecommunicationAddress phone1 = list[0];
            TelecommunicationAddress phone2 = list[1];
            TelecommunicationAddress phone3 = list[2];
            TelecommunicationAddress phone4 = list[3];

            Assert.AreEqual("+1-519-555-2345;ext=1", phone1.Address);
            Assert.AreEqual("+1-519-555-2345;ext=2", phone2.Address);
            Assert.AreEqual("+1-519-555-2345;ext=3", phone3.Address);
            Assert.AreEqual("+1-416-555-2345;ext=4", phone4.Address);
        }
コード例 #2
0
        /// <exception cref="Ca.Infoway.Messagebuilder.Marshalling.HL7.XmlToModelTransformationException"></exception>
        private Interval <Int32?> Parse(XmlNode node)
        {
            BareANY ivl = this.parser.Parse(ParseContextImpl.Create("IVL<INT>", typeof(Interval <object>), SpecificationVersion.V02R02
                                                                    , null, null, null, null, null, false), Arrays.AsList(node), this.result);

            return((Interval <Int32?>)(ivl.BareValue));
        }
コード例 #3
0
        public virtual void TestParseTooManyTranslations()
        {
            XmlNode node = CreateNode("<something code=\"BARNEY\" codeSystem=\"1.2.3.4.5\">" + "<translation code=\"FRED\" codeSystem=\"1.2.3.4.5\" />"
                                      + "<translation code=\"WILMA\" codeSystem=\"1.2.3.4.5\" />" + "<translation code=\"BETTY\" codeSystem=\"1.2.3.4.5\" />"
                                      + "<translation code=\"BAM_BAM\" codeSystem=\"1.2.3.4.5\" />" + "<translation code=\"FRED\" codeSystem=\"1.2.3.4.5\" />"
                                      + "<translation code=\"WILMA\" codeSystem=\"1.2.3.4.5\" />" + "<translation code=\"BETTY\" codeSystem=\"1.2.3.4.5\" />"
                                      + "<translation code=\"BAM_BAM\" codeSystem=\"1.2.3.4.5\" />" + "<translation code=\"FRED\" codeSystem=\"1.2.3.4.5\" />"
                                      + "<translation code=\"WILMA\" codeSystem=\"1.2.3.4.5\" />" + "<translation code=\"BETTY\" codeSystem=\"1.2.3.4.5\" /></something>"
                                      );
            CD cd = (CD)this.parser.Parse(ParseContextImpl.Create("CD", 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.IsNotNull(cd.Value, "main enum found");
            Assert.IsFalse(cd.Translations.IsEmpty(), "translation enums found");
            Assert.IsTrue(cd.Translations.Count == 11, "translation enums found");
            Assert.AreEqual(1, this.xmlResult.GetHl7Errors().Count, "error message count");
            Assert.AreEqual("BARNEY", cd.Value.CodeValue, "main code");
            Assert.AreEqual("FRED", cd.Translations[0].Value.CodeValue, "translation");
            Assert.AreEqual("BETTY", cd.Translations[10].Value.CodeValue, "translation");
            Assert.IsTrue(this.xmlResult.GetHl7Errors()[0].GetMessage().StartsWith("A maximum of 10 translations are allowed."), "error message"
                          );
            Assert.AreEqual(Hl7ErrorCode.DATA_TYPE_ERROR, this.xmlResult.GetHl7Errors()[0].GetHl7ErrorCode(), "error type");
        }
コード例 #4
0
        public virtual void ShouldParseValidInformationForSk()
        {
            XmlNode node = CreateNode("<effectiveTime>" + "  <comp operator=\"I\">" + "    <low specializationType=\"TS.FULLDATE\" value=\"20050803\"/>"
                                      + "    <width specializationType=\"TS.FULLDATE\" value=\"3\" unit=\"wk\"/>" + "  </comp>" + "  <comp>" + "    <frequency>"
                                      + "      <numerator specializationType=\"INT.NONNEG\" value=\"3\"/>" + "      <denominator>" + "        <low unit=\"d\" value=\"3\"/>"
                                      + "        <high unit=\"d\" value=\"10\"/>" + "      </denominator>" + "    </frequency>" + "  </comp>" + "</effectiveTime>"
                                      );
            ParseContext context = ParseContextImpl.Create("GTS.BOUNDEDPIVL", typeof(GeneralTimingSpecification), SpecificationVersion
                                                           .V01R04_2_SK, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, null, null, false);
            GeneralTimingSpecification result = (GeneralTimingSpecification) new GtsBoundedPivlElementParser().Parse(context, node, this
                                                                                                                     .xmlResult).BareValue;

            Assert.IsNotNull(result, "result");
            Assert.AreEqual(new BigDecimal("3"), ((DateDiff)result.Duration.Width).ValueAsPhysicalQuantity.Quantity, "interval width value"
                            );
            Assert.AreEqual("wk", ((DateDiff)result.Duration.Width).Unit.CodeValue, "interval width unit");
            Assert.IsTrue(result.Frequency is PeriodicIntervalTimeSk, "frequency is for SK");
            Assert.AreEqual(3, result.Frequency.Repetitions, "frequency times");
            Assert.AreEqual(new BigDecimal("3"), ((PeriodicIntervalTimeSk)result.Frequency).QuantitySk.Low.Quantity, "low frequency period value"
                            );
            Assert.AreEqual("d", ((PeriodicIntervalTimeSk)result.Frequency).QuantitySk.Low.Unit.CodeValue, "low frequency period unit"
                            );
            Assert.AreEqual(new BigDecimal("10"), ((PeriodicIntervalTimeSk)result.Frequency).QuantitySk.High.Quantity, "high frequency period value"
                            );
            Assert.AreEqual("d", ((PeriodicIntervalTimeSk)result.Frequency).QuantitySk.High.Unit.CodeValue, "high frequency period unit"
                            );
        }
コード例 #5
0
        public virtual void TestIvlTsConstraintsInvalid()
        {
            XmlToModelResult    result      = new XmlToModelResult();
            XmlNode             node        = CreateNode("<ivl><low value=\"20120503\"/><high value=\"20120708\"/></ivl>");
            ConstrainedDatatype constraints = new ConstrainedDatatype("ivl", "IVL<TS>");

            constraints.Relationships.Add(new Relationship("low", "TS", Cardinality.Create("0")));
            constraints.Relationships.Add(new Relationship("high", "TS", Cardinality.Create("0")));
            ParseContext context = ParseContextImpl.Create("IVLTSCDAR1", null, SpecificationVersion.R02_04_03, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel
                                                           .MANDATORY, Cardinality.Create("1"), constraints, true);
            BareANY                 parseResult         = this.parser.Parse(context, Arrays.AsList(node), result);
            PlatformDate            dateLow             = DateUtil.GetDate(2012, 4, 3);
            DateWithPattern         dateWithPatternLow  = new DateWithPattern(dateLow, "yyyyMMdd");
            PlatformDate            dateHigh            = DateUtil.GetDate(2012, 6, 8);
            DateWithPattern         dateWithPatternHigh = new DateWithPattern(dateHigh, "yyyyMMdd");
            Interval <PlatformDate> expectedIvl         = IntervalFactory.CreateLowHigh((PlatformDate)dateWithPatternLow, (PlatformDate)dateWithPatternHigh
                                                                                        );

            Assert.IsFalse(result.IsValid());
            Assert.AreEqual(2, result.GetHl7Errors().Count);
            Assert.IsTrue(parseResult is IVLTSCDAR1);
            DateInterval ivl = (DateInterval)parseResult.BareValue;

            Assert.AreEqual(expectedIvl, ivl.Interval);
        }
コード例 #6
0
        public virtual void TestParseUrgForBC()
        {
            ParseContext context = ParseContextImpl.Create("URG<PQ.LAB>", null, SpecificationVersion.V02R04_BC, null, null, null, null
                                                           , null, null, null, false);
            string xml = "<value specializationType=\"URG_PQ.LAB\" unit=\"1\" xsi:type=\"URG_PQ\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
                         + "<originalText mediaType=\"text/plain\" representation=\"TXT\">&lt;124</originalText>" + "<low inclusive=\"true\" nullFlavor=\"NI\" specializationType=\"PQ.LAB\" value=\"1\" />"
                         + "<high inclusive=\"false\" specializationType=\"PQ.LAB\" unit=\"g/L\" value=\"124\"/>" + "</value>";
            XmlNode node = CreateNode(xml);
            BareANY URG  = new UrgPqElementParser().Parse(context, node, this.xmlResult);
            UncertainRange <PhysicalQuantity> range = (UncertainRange <PhysicalQuantity>)URG.BareValue;

            Assert.IsNotNull(range, "null");
            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.AreEqual(Representation.LOW_HIGH, range.Representation, "representation");
            Assert.AreEqual("<124", ((ANYMetaData)URG).OriginalText, "OT");
            Assert.IsTrue(range.LowInclusive.Value, "low inclusive");
            Assert.AreEqual(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION, range.LowNullFlavor, "low NF"
                            );
            Assert.AreEqual(BigDecimal.ONE, range.Low.Quantity, "low value");
            Assert.IsNull(range.Low.Unit, "low unit");
            Assert.IsFalse(range.HighInclusive.Value, "high inclusive");
            Assert.IsNull(range.HighNullFlavor, "high NF");
            Assert.AreEqual(new BigDecimal("124"), range.High.Quantity, "high value");
            Assert.AreEqual("g/L", range.High.Unit.CodeValue, "high units");
            Assert.IsTrue(range.High.Unit is x_LabUnitsOfMeasure);
        }
コード例 #7
0
        public virtual void TestPivlPhasePeriod()
        {
            XmlToModelResult result = new XmlToModelResult();
            XmlNode          node   = CreateNode("<pivl><period unit=\"d\" value=\"1\"/><phase><low value=\"20120503\"/><high value=\"20120708\"/></phase></pivl>"
                                                 );
            ParseContext context = ParseContextImpl.Create("PIVLTSCDAR1", null, SpecificationVersion.R02_04_03, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel
                                                           .MANDATORY, Cardinality.Create("1"), null, true);
            BareANY          parseResult    = this.parser.Parse(context, Arrays.AsList(node), result);
            PhysicalQuantity expectedPeriod = new PhysicalQuantity(BigDecimal.ONE, Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                                   .DAY);
            PlatformDate            dateLow             = DateUtil.GetDate(2012, 4, 3);
            DateWithPattern         dateWithPatternLow  = new DateWithPattern(dateLow, "yyyyMMdd");
            PlatformDate            dateHigh            = DateUtil.GetDate(2012, 6, 8);
            DateWithPattern         dateWithPatternHigh = new DateWithPattern(dateHigh, "yyyyMMdd");
            Interval <PlatformDate> expectedPhase       = IntervalFactory.CreateLowHigh((PlatformDate)dateWithPatternLow, (PlatformDate)dateWithPatternHigh
                                                                                        );

            Assert.IsTrue(result.IsValid());
            Assert.IsTrue(parseResult is PIVLTSCDAR1);
            PeriodicIntervalTimeR2 pivl = (PeriodicIntervalTimeR2)parseResult.BareValue;

            Assert.AreEqual(expectedPeriod.Quantity, pivl.Period.Quantity);
            Assert.AreEqual(expectedPeriod.Unit.CodeValue, pivl.Period.Unit.CodeValue);
            Assert.AreEqual(expectedPhase, pivl.Phase);
            Assert.IsNull(pivl.FrequencyRepetitions);
            Assert.IsNull(pivl.FrequencyQuantity);
        }
コード例 #8
0
        public virtual void TestParseCdWithAllMetadata()
        {
            XmlNode node = CreateNode("<something code=\"BARNEY\" codeSystem=\"1.2.3.4.5\" displayName=\"a display name\" specializationType=\"CD.LAB\">"
                                      + "<originalText>some original text</originalText>" + "<translation code=\"FRED\" codeSystem=\"1.2.3.4.5\" />" + "<translation code=\"WILMA\" codeSystem=\"1.2.3.4.5\" />"
                                      + "<translation code=\"BETTY\" codeSystem=\"1.2.3.4.5\" />" + "<translation code=\"BAM_BAM\" codeSystem=\"1.2.3.4.5\" /></something>"
                                      );
            BareANY cdAny = new AnyElementParser().Parse(ParseContextImpl.Create("ANY", typeof(object), SpecificationVersion.V02R02,
                                                                                 null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, null, null, false), node, this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.IsNotNull(cdAny.BareValue);
            Assert.IsTrue(cdAny.BareValue is Code);
            Code value = (Code)cdAny.BareValue;

            Assert.IsNotNull(value, "main enum found");
            Assert.AreEqual("BARNEY", value.CodeValue, "main code");
            ANYMetaData cd = (ANYMetaData)cdAny;

            Assert.IsFalse(cd.Translations.IsEmpty(), "translation enums found");
            Assert.IsTrue(cd.Translations.Count == 4, "translation enums found");
            Assert.AreEqual(0, this.xmlResult.GetHl7Errors().Count, "error message count");
            Assert.AreEqual("FRED", cd.Translations[0].Value.CodeValue, "translation");
            Assert.AreEqual("WILMA", cd.Translations[1].Value.CodeValue, "translation");
            Assert.AreEqual("BETTY", cd.Translations[2].Value.CodeValue, "translation");
            Assert.AreEqual("BAM_BAM", cd.Translations[3].Value.CodeValue, "translation");
        }
コード例 #9
0
        public virtual void TestParseInvalidTranslation()
        {
            // triggers every error for translations
            XmlNode node = CreateNode("<something code=\"BARNEY\" codeSystem=\"1.2.3.4.5\">" + "<translation nullFlavor=\"OTH\" codeSystemName=\"aName\" codeSystemVersion=\"123\" displayName=\"aName\" >"
                                      + "  <originalText>should not be here</originalText>" + "  <translation code=\"FRED\" codeSystem=\"1.2.3.4.5\" />" + "  <qualifier />"
                                      + "</translation>" + "</something>");
            CD cd = (CD)this.parser.Parse(ParseContextImpl.Create("CD", 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(8, this.xmlResult.GetHl7Errors().Count, "error message count");
            Assert.IsNotNull(cd.Value, "main enum found");
            Assert.AreEqual("BARNEY", cd.Value.CodeValue, "main code");
            Assert.AreEqual(1, cd.Translations.Count, "translation enum not found");
            Assert.IsTrue(this.xmlResult.GetHl7Errors()[0].GetMessage().StartsWith("CD should not include the 'codeSystemName' property."
                                                                                   ), "error message");
            Assert.IsTrue(this.xmlResult.GetHl7Errors()[1].GetMessage().StartsWith("CD should not include the 'codeSystemVersion' property."
                                                                                   ), "error message");
            Assert.IsTrue(this.xmlResult.GetHl7Errors()[2].GetMessage().StartsWith("CD should not include the 'qualifier' property.")
                          , "error message");
            Assert.IsTrue(this.xmlResult.GetHl7Errors()[3].GetMessage().StartsWith("(translation level) Translation may not contain other translations."
                                                                                   ), "error message");
            Assert.IsTrue(this.xmlResult.GetHl7Errors()[4].GetMessage().StartsWith("(translation level) Translation may not contain a NullFlavor."
                                                                                   ), "error message");
            Assert.IsTrue(this.xmlResult.GetHl7Errors()[5].GetMessage().StartsWith("(translation level) Translation may not contain originalText."
                                                                                   ), "error message");
            Assert.IsTrue(this.xmlResult.GetHl7Errors()[6].GetMessage().StartsWith("(translation level) Translation may not contain displayName."
                                                                                   ), "error message");
            Assert.IsTrue(this.xmlResult.GetHl7Errors()[7].GetMessage().StartsWith("(translation level) Code and codeSystem properties must be provided."
                                                                                   ), "error message");
        }
コード例 #10
0
        private PhysicalQuantity ParseDenominator(ParseContext context, XmlElement numerator, XmlToModelResult xmlToModelResult)
        {
            ElementParser parser     = ParserRegistry.GetInstance().Get("PQ.TIME");
            ParseContext  subContext = ParseContextImpl.Create("PQ.TIME", typeof(PhysicalQuantity), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel
                                                               .MANDATORY, Cardinality.Create("1"), context);

            return((PhysicalQuantity)parser.Parse(subContext, Arrays.AsList((XmlNode)numerator), xmlToModelResult).BareValue);
        }
コード例 #11
0
        private Int32?ParseNumerator(ParseContext context, XmlElement numerator, XmlToModelResult xmlToModelResult)
        {
            ElementParser parser     = ParserRegistry.GetInstance().Get("INT.NONNEG");
            ParseContext  subContext = ParseContextImpl.Create("INT.NONNEG", typeof(Int32?), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel
                                                               .MANDATORY, Cardinality.Create("1"), context);

            return((Int32?)parser.Parse(subContext, Arrays.AsList((XmlNode)numerator), xmlToModelResult).BareValue);
        }
コード例 #12
0
        /// <exception cref="Ca.Infoway.Messagebuilder.Marshalling.HL7.XmlToModelTransformationException"></exception>
        private Interval <PlatformDate> Parse(XmlNode node, string type, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel conformanceLevel
                                              )
        {
            TimeZoneInfo timeZone = TimeZoneUtil.GetTimeZone("America/Toronto");

            return((Interval <PlatformDate>) this.parser.Parse(ParseContextImpl.Create(type, typeof(Interval <object>), SpecificationVersion
                                                                                       .V02R02, timeZone, timeZone, conformanceLevel, null, null, false), Arrays.AsList(node), this.result).BareValue);
        }
コード例 #13
0
 public override void SetUp()
 {
     base.SetUp();
     this.context = ParseContextImpl.Create("BL", typeof(Boolean?), SpecificationVersion.V02R02, null, null, null, null, null,
                                            false);
     this.result = new XmlToModelResult();
     this.parser = new BlElementParser();
 }
コード例 #14
0
 public override void SetUp()
 {
     base.SetUp();
     this.parser    = new IiElementParser();
     this.xmlResult = new XmlToModelResult();
     this.context   = ParseContextImpl.Create("II.TOKEN", typeof(Identifier), SpecificationVersion.V02R02, null, null, null, null
                                              , null, false);
 }
コード例 #15
0
        private PeriodicIntervalTime ParseFrequency(ParseContext context, XmlToModelResult xmlToModelResult, XmlElement durationElement
                                                    )
        {
            ParseContext subContext = ParseContextImpl.Create("PIVL<TS.DATETIME>", typeof(PeriodicIntervalTime), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel
                                                              .MANDATORY, Cardinality.Create("1"), context);

            return((PeriodicIntervalTime)ParserRegistry.GetInstance().Get("PIVL<TS.DATETIME>").Parse(subContext, Arrays.AsList((XmlNode
                                                                                                                                )durationElement), xmlToModelResult).BareValue);
        }
コード例 #16
0
        public virtual void TestParseValidEnumCodeButNoCodeSystem()
        {
            XmlNode node = CreateNode("<something code=\"FRED\" />");
            CV      cv   = (CV)this.parser.Parse(ParseContextImpl.Create("CV", typeof(MockCharacters), SpecificationVersion.V02R02, null, null
                                                                         , Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, null, false), node, this.xmlResult);

            Assert.IsFalse(this.xmlResult.IsValid(), "valid");
            Assert.AreEqual(MockEnum.FRED, cv.Value, "enum found properly");
        }
コード例 #17
0
        public virtual void TestParseInvalidNullFavorAttributeValue()
        {
            XmlNode node = CreateNode("<something nullFlavor=\"NOT A VALID NULL FAVOR VALUE\"/>");

            this.parser.Parse(ParseContextImpl.Create("CV", 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(2, this.xmlResult.GetHl7Errors().Count, "warning message count");
        }
コード例 #18
0
        private Interval <PlatformDate> ParseDuration(ParseContext context, XmlToModelResult xmlResult, XmlElement durationElement
                                                      )
        {
            ParseContext subContext = ParseContextImpl.Create("IVL<TS.FULLDATE>", typeof(Interval <object>), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel
                                                              .MANDATORY, Cardinality.Create("1"), context);

            return((Interval <PlatformDate>)ParserRegistry.GetInstance().Get("IVL<TS.FULLDATE>").Parse(subContext, Arrays.AsList((XmlNode
                                                                                                                                  )durationElement), xmlResult).BareValue);
        }
コード例 #19
0
        public virtual void TestParseTooManyChildNodes()
        {
            XmlNode node = CreateNode("<something>" + "<monkey/>" + "</something>");
            CD      cs   = (CD) new CvElementParser().Parse(ParseContextImpl.Create("CS", typeof(MockCode), SpecificationVersion.V02R02, null
                                                                                    , null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, null, false), node, this.xmlResult);

            Assert.IsFalse(this.xmlResult.IsValid());
            Assert.IsNull(cs.Value, "empty node with children returns null");
        }
コード例 #20
0
        public virtual void TestParseValid()
        {
            XmlNode node = CreateNode("<something code=\"ER\" />");
            CD      cs   = (CD) new CvElementParser().Parse(ParseContextImpl.Create("CS", typeof(MockCode), SpecificationVersion.V02R02, null
                                                                                    , null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, null, false), node, this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid());
            Assert.AreEqual("ER", cs.Value.CodeValue, "node with code attribute returns value");
        }
コード例 #21
0
        public virtual void TestParseValidCodeWithMaxCodeValueCeRx()
        {
            XmlNode node = CreateNode("<something code=\"12345678901234567890\" codeSystem=\"1.2.3.4.5\"/>");
            CV      cv   = (CV)this.parser.Parse(ParseContextImpl.Create("CV", typeof(MockCharacters), SpecificationVersion.V01R04_3, null,
                                                                         null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, null, false), node, this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid(), "valid");
            Assert.AreEqual(MockEnum.CERX_MAX, cv.Value, "enum found properly");
        }
コード例 #22
0
        public virtual void TestParseNullNode()
        {
            XmlNode node = CreateNode("<something nullFlavor=\"NI\"/>");
            CV      cv   = (CV)this.parser.Parse(ParseContextImpl.Create("CV", 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(cv.Value, "value");
            Assert.AreEqual(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION, cv.NullFlavor, "null flavor");
        }
コード例 #23
0
        public virtual void TestParseOtherNullNodeWithWrongCodeSystem()
        {
            XmlNode node = CreateNode("<something nullFlavor=\"OTH\" codeSystem=\"1.2.3.4.wrong.code.system\" />");
            CV      cv   = (CV)this.parser.Parse(ParseContextImpl.Create("CV", 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("1.2.3.4.wrong.code.system", cv.Value.CodeSystem, "code system");
            Assert.AreEqual(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.OTHER, cv.NullFlavor, "null flavor");
        }
コード例 #24
0
        public virtual void TestParseContainsOriginalTextAndNullFlavor()
        {
            XmlNode node = CreateNode("<something nullFlavor=\"NI\"><originalText>My original text</originalText></something>");
            CV      cs   = (CV)this.parser.Parse(ParseContextImpl.Create("CV", 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(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION, cs.NullFlavor, "null flavor");
            Assert.AreEqual("My original text", cs.OriginalText, "original text");
        }
コード例 #25
0
        public virtual void TestParseInvalid()
        {
            XmlNode node = CreateNode("<something code=\"ER\" />");
            CV      cv   = (CV)this.parser.Parse(ParseContextImpl.Create("CV", 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(3, this.xmlResult.GetHl7Errors().Count);
            Assert.IsNull(cv.Value, "node with no code attribute returns null");
        }
コード例 #26
0
        private Interval <PhysicalQuantity> ParseDenominatorSk(ParseContext context, XmlElement numerator, XmlToModelResult xmlToModelResult
                                                               )
        {
            // TM - Unsure if SK is allowed to send in any kind of PQ, or only specific ones. Picked PQ.BASIC to cover most scenarios.
            ElementParser parser     = ParserRegistry.GetInstance().Get("IVL<PQ.BASIC>");
            ParseContext  subContext = ParseContextImpl.Create("IVL<PQ.BASIC>", typeof(PhysicalQuantity), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel
                                                               .MANDATORY, Cardinality.Create("1"), context);

            return((Interval <PhysicalQuantity>)parser.Parse(subContext, Arrays.AsList((XmlNode)numerator), xmlToModelResult).BareValue);
        }
コード例 #27
0
        public virtual void TestParseContainsOriginalText()
        {
            XmlNode node = CreateNode("<something code=\"ER\"><originalText>My original text</originalText></something>");
            CD      cs   = (CD) new CvElementParser().Parse(ParseContextImpl.Create("CS", typeof(MockCode), SpecificationVersion.V02R02, null
                                                                                    , null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, null, false), node, this.xmlResult);

            Assert.IsFalse(this.xmlResult.IsValid(), "valid");
            Assert.IsNotNull(cs, "cs");
            Assert.IsNotNull(cs.Value, "code");
        }
コード例 #28
0
        public virtual void TestParseValidEnumCode()
        {
            XmlNode node = CreateNode("<something code=\"FRED\" />");
            CD      cs   = (CD) new CvElementParser().Parse(ParseContextImpl.Create("CS", 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(MockEnum.FRED, cs.Value, "enum found properly");
            Assert.AreEqual(0, this.xmlResult.GetHl7Errors().Count, "error message count");
        }
コード例 #29
0
        public virtual void TestParseValidWithInvalidNullFavorAttributeValue()
        {
            XmlNode node = CreateNode("<something code=\"BARNEY\" nullFlavor=\"NOT A VALID NULL FAVOR VALUE\"/>");
            CV      cv   = (CV)this.parser.Parse(ParseContextImpl.Create("CV", 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(2, this.xmlResult.GetHl7Errors().Count);
            Assert.AreEqual("BARNEY", cv.Value.CodeValue, "node with no code attribute returns null");
        }
コード例 #30
0
        public virtual void ShouldParseNullFlavor()
        {
            XmlNode      node    = CreateNode("<effectiveTime nullFlavor=\"NI\"></effectiveTime>");
            ParseContext context = ParseContextImpl.Create("GTS.BOUNDEDPIVL", typeof(GeneralTimingSpecification), SpecificationVersion
                                                           .V02R02, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, null, null, false);
            GTS gts = (GTS) new GtsBoundedPivlElementParser().Parse(context, node, this.xmlResult);

            Assert.AreEqual(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION, gts.NullFlavor, "null flavor"
                            );
        }