Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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\">]]&gt;<![CDATA[---]]>]]&gt;<![CDATA[---]]>]]&gt;</FL>"), "Should have separate CData blocks with escaped ']]>'");
        }
Ejemplo n.º 3
0
        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>"));
        }
Ejemplo n.º 4
0
        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\" />"));
        }