public void should_not_include_null_value() { // Arrange var zohoOrder = new ZohoPotential(Guid.NewGuid().ToString()); zohoOrder.SetValue("test", null); // Act var collection = new ZohoEntityCollection <ZohoPotential> { zohoOrder }; // Assert string xml = null; Assert.DoesNotThrow(() => xml = collection.ToXmlString()); Assert.That(xml, Is.Not.Null); Assert.That(xml.Contains("<FL val=\"test\">"), Is.False); }
public void should_handle_multiple_invalid_cdata_string() { // Arrange var zohoOrder = new ZohoPotential(Guid.NewGuid().ToString()); zohoOrder.SetValue("test", "]]>---]]>---]]>"); // Cannot have ']]>' inside an XML CDATA block // Act var collection = new ZohoEntityCollection <ZohoPotential> { zohoOrder }; // Assert string xml = null; Assert.DoesNotThrow(() => xml = collection.ToXmlString()); Assert.That(xml, Is.Not.Null); Assert.That(xml.Contains("<FL val=\"test\">]]><![CDATA[---]]>]]><![CDATA[---]]>]]></FL>"), "Should have separate CData blocks with escaped ']]>'"); }
public void should_send_data_in_cdata_block() { // Arrange var zohoOrder = new ZohoPotential(Guid.NewGuid().ToString()); zohoOrder.SetValue("test", "---some-data---"); // Act var collection = new ZohoEntityCollection <ZohoPotential> { zohoOrder }; // Assert string xml = null; Assert.DoesNotThrow(() => xml = collection.ToXmlString()); Assert.That(xml, Is.Not.Null); Assert.That(xml.Contains("<FL val=\"test\"><![CDATA[---some-data---]]></FL>")); }
public void should_create_empty_tag_with_empty_string() { // Arrange var zohoOrder = new ZohoPotential(Guid.NewGuid().ToString()); zohoOrder.SetValue("test", ""); // Act var collection = new ZohoEntityCollection <ZohoPotential> { zohoOrder }; // Assert string xml = null; Assert.DoesNotThrow(() => xml = collection.ToXmlString()); Assert.That(xml, Is.Not.Null); Assert.That(xml.Contains("<FL val=\"test\" />")); }