Exemplo n.º 1
0
        public virtual void TestParseValueWithUnsorted()
        {
            XmlNode node   = CreateNode("<something unsorted=\"true\" value=\"1345\" />");
            INTImpl anyInt = (INTImpl) new IntR2ElementParser().Parse(CreateContext("INT"), node, this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid(), "no errors");
            Assert.AreEqual(System.Convert.ToInt32("1345"), anyInt.BareValue, "correct value returned");
            Assert.IsTrue(anyInt.Unsorted, "unsorted");
        }
Exemplo n.º 2
0
        public virtual void TestSxcmNoOperator()
        {
            string integerValue = "123";

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (this.result, null, "name", "SXCM<INT>", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.REQUIRED, null, false);
            INTImpl dataType = new INTImpl(System.Convert.ToInt32(integerValue));
            string  output   = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().Format(context, dataType);

            Assert.AreEqual("<name value=\"123\"/>", output.Trim(), "xml output as expected");
            Assert.IsTrue(context.GetModelToXmlResult().IsValid());
        }
Exemplo n.º 3
0
        private void AppendSk(StringBuilder buffer, Int32?repetitions, Interval <PhysicalQuantity> quantity, int indentLevel, FormatContext
                              context)
        {
            INTImpl       intImpl       = new INTImpl(repetitions);
            FormatContext formatContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("INT.NONNEG", context
                                                                                                                    .IsSpecializationType(), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), "numerator",
                                                                                                                    context);

            buffer.Append(this.intNonNegPropertyFormatter.Format(formatContext, intImpl, indentLevel));
            IVLImpl <PQ, Interval <PhysicalQuantity> > ivlImpl = new IVLImpl <PQ, Interval <PhysicalQuantity> >(quantity);

            formatContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("IVL<PQ.BASIC>", context.IsSpecializationType
                                                                                                          (), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), "denominator", context);
            buffer.Append(this.ivlPqPropertyFormatter.Format(formatContext, ivlImpl, indentLevel));
        }
Exemplo n.º 4
0
        public virtual void TestIntegerOperatorNotAllowed()
        {
            string integerValue = "123";

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (this.result, null, "name", "INT", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.REQUIRED, null, false);
            INTImpl dataType = new INTImpl(System.Convert.ToInt32(integerValue));

            dataType.Operator = SetOperator.INCLUDE;
            string output = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().Format(context, dataType);

            Assert.AreEqual("<name value=\"123\"/>", output.Trim(), "xml output as expected");
            Assert.IsFalse(context.GetModelToXmlResult().IsValid());
            Assert.AreEqual(1, context.GetModelToXmlResult().GetHl7Errors().Count);
        }