コード例 #1
0
        public virtual void TestFormatValueNonNull()
        {
            AbstractPropertyFormatter formatter = new StPropertyFormatter();
            FormatContext             context   = GetContext("name");
            string result = formatter.Format(context, new STImpl("something"));

            Assert.AreEqual(AddLineSeparator("<name>something</name>"), result, "something in text node");
            AssertNoErrors(context);
        }
コード例 #2
0
        public virtual void TestFormatValueReservedXmlChars()
        {
            AbstractPropertyFormatter formatter = new StPropertyFormatter();
            FormatContext             context   = GetContext("name");
            string result = formatter.Format(context, new STImpl("<cats think they're > humans & dogs 99% of the time/>"));

            Assert.AreEqual("<name>&lt;cats think they&apos;re &gt; humans &amp; dogs 99% of the time/&gt;</name>".Trim(), result.Trim
                                (), "something in text node");
            AssertNoErrors(context);
        }
コード例 #3
0
        public virtual void TestFormatValueNonNullWithLanguageFr()
        {
            AbstractPropertyFormatter formatter = new StPropertyFormatter();
            FormatContext             context   = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(new ModelToXmlResult(),
                                                                                                                            null, "name", "ST.LANG", null, null, false);
            string result = formatter.Format(context, new STImpl("something", "fr-CA"));

            Assert.AreEqual(AddLineSeparator("<name language=\"fr-CA\">something</name>"), result, "something in text node");
            AssertNoErrors(context);
        }
コード例 #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");
        }
コード例 #5
0
        public virtual void TestFormatCdataValueNonNull()
        {
            AbstractPropertyFormatter formatter = new StPropertyFormatter();
            FormatContext             context   = GetContext("name");
            STImpl dataType = new STImpl("something");

            dataType.IsCdata = true;
            string result = formatter.Format(context, dataType);

            Assert.AreEqual(AddLineSeparator("<name><![CDATA[something]]></name>"), result, "something in text node");
            AssertNoErrors(context);
        }
コード例 #6
0
        public virtual void TestFormatCdataValueNonNullWithSpecialCharacters()
        {
            AbstractPropertyFormatter formatter = new StPropertyFormatter();
            FormatContext             context   = GetContext("name");
            STImpl dataType = new STImpl("<cats think they're > humans & dogs 99% of the time/>");

            dataType.IsCdata = true;
            string result = formatter.Format(context, dataType);

            Assert.AreEqual(AddLineSeparator("<name><![CDATA[<cats think they're > humans & dogs 99% of the time/>]]></name>"), result
                            , "something in text node");
            AssertNoErrors(context);
        }