示例#1
0
        public virtual void TestNullCaseNotMandatory()
        {
            string result = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                       (this.result, null, "name", "INT", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, false), null);

            Assert.IsTrue(StringUtils.IsBlank(result), "result");
            Assert.IsTrue(this.result.IsValid(), "no errors");
        }
示例#2
0
        public virtual void TestNullCasePopulated()
        {
            string result = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                       (this.result, null, "name", "INT", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.POPULATED, null, false), new INTImpl()
                                                                                                   );

            AssertXml("result", "<name nullFlavor=\"NI\"/>", result);
            Assert.IsTrue(this.result.IsValid(), "no errors");
        }
示例#3
0
        public virtual void TestGetAttributeNameValuePairsIntegerValid()
        {
            string integerValue = "34";
            IDictionary <string, string> result = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(this.result, null, "name", null, null, null,
                                                                                                                                 false), System.Convert.ToInt32(integerValue), null);

            Assert.AreEqual(1, result.Count, "map size");
            Assert.IsTrue(result.ContainsKey("value"), "key as expected");
            Assert.AreEqual(integerValue, result.SafeGet("value"), "value as expected");
            Assert.IsTrue(this.result.IsValid(), "no errors");
        }
示例#4
0
        public virtual void TestGetAttributeNameValuePairsNullValue()
        {
            IDictionary <string, string> result = new IntR2PropertyFormatterTest.TestableIntR2PropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(this.result, null, "name", null, null, null,
                                                                                                                                 false), null, new INTImpl());

            // a null value for INT elements results in a nullFlavor attribute
            Assert.AreEqual(1, result.Count, "map size");
            Assert.IsTrue(result.ContainsKey("nullFlavor"), "key as expected");
            Assert.AreEqual(AbstractPropertyFormatter.NULL_FLAVOR_NO_INFORMATION, result.SafeGet("nullFlavor"), "value as expected");
            Assert.IsTrue(this.result.IsValid(), "no errors");
        }
示例#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());
        }
示例#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");
        }
示例#7
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);
        }
示例#8
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());
        }