Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public virtual void TestGetAttributeNameValuePairsIntegerZero()
        {
            string integerValue = "0";

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (new ModelToXmlResult(), null, "name", "INT.POS", null, null, false);
            Int32?integer = System.Convert.ToInt32(integerValue);
            IDictionary <string, string> result = new TestableIntPosPropertyFormatter().GetAttributeNameValuePairsForTest(context, integer
                                                                                                                          , new INTImpl(integer));

            Assert.AreEqual(1, result.Count, "map size");
            Assert.IsTrue(result.ContainsKey("value"), "key as expected");
            Assert.AreEqual(integerValue, result.SafeGet("value"), "value as expected");
            context.GetModelToXmlResult().ClearErrors();
            string output = new TestableIntPosPropertyFormatter().Format(context, new INTImpl(integer));

            Assert.AreEqual("<name value=\"0\"/>", output.Trim(), "xml output as expected");
            Assert.AreEqual(1, context.GetModelToXmlResult().GetHl7Errors().Count, "1 error");
        }
Exemplo n.º 3
0
        public virtual void TestGetAttributeNameValuePairsIntegerNegative()
        {
            string integerValue = "-1";

            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);
            Int32?integer = System.Convert.ToInt32(integerValue);
            IDictionary <string, string> result = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, integer, new INTImpl(integer));

            Assert.AreEqual(1, result.Count, "map size");
            Assert.IsTrue(result.ContainsKey("value"), "key as expected");
            Assert.AreEqual(integerValue, result.SafeGet("value"), "value as expected");
            context.GetModelToXmlResult().ClearErrors();
            string output = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().Format(context, new INTImpl(integer));

            Assert.AreEqual("<name value=\"-1\"/>", output.Trim(), "xml output as expected");
            Assert.IsTrue(context.GetModelToXmlResult().IsValid());
        }
Exemplo n.º 4
0
        public virtual void TestFormatValueNonNullWithLanguageNotAllowed()
        {
            AbstractPropertyFormatter formatter = new StPropertyFormatter();

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (new ModelToXmlResult(), null, "name", "ST", null, null, false);
            string result = formatter.Format(context, new STImpl("something", "fr-CA"));

            Assert.AreEqual(AddLineSeparator("<name>something</name>"), RemoveErrorComments(result), "something in text node");
            Assert.AreEqual(1, context.GetModelToXmlResult().GetHl7Errors().Count, "error from language not allowed");
        }
Exemplo n.º 5
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.º 6
0
        public virtual void TestGetAttributeNameValuePairsIntegerZeroNoWarnings()
        {
            string integerValue = "0";

            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);
            string output = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().Format(context, new INTImpl(System.Convert.ToInt32
                                                                                                                            (integerValue)));

            Assert.AreEqual("<name value=\"0\"/>", output.Trim(), "xml output as expected");
            Assert.IsTrue(context.GetModelToXmlResult().IsValid(), "no errors");
        }