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); }
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><cats think they're > humans & dogs 99% of the time/></name>".Trim(), result.Trim (), "something in text node"); AssertNoErrors(context); }
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); }
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"); }
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); }
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); }