public void should_return_responseItem_with_requestItem()
        {
            var response = @"<?xml version=""1.0"" encoding=""UTF-8"" ?>
                                <response uri=""/crm/private/xml/Potentials/insertRecords"">
                                    <result>
                                        <row no=""1"">
                                            <success><code>2001</code><details><FL val=""Id"">2829458000000286010</FL><FL val=""Created Time"">2017-11-23 20:29:23</FL><FL val=""Modified Time"">2017-11-23 20:31:38</FL><FL val=""Created By""><![CDATA[Sam McGoldrick]]></FL><FL val=""Modified By""><![CDATA[Sam McGoldrick]]></FL></details></success>
                                        </row>
                                        <row no=""2"">
                                            <success><code>2001</code><details><FL val=""Id"">2829458000000286011</FL><FL val=""Created Time"">2017-11-23 20:29:23</FL><FL val=""Modified Time"">2017-11-23 20:31:38</FL><FL val=""Created By""><![CDATA[Sam McGoldrick]]></FL><FL val=""Modified By""><![CDATA[Sam McGoldrick]]></FL></details></success>
                                        </row>
                                    </result>
                                </response>";

            var potential1 = new ZohoPotential("")
            {
                RowNumber = 1
            };
            var potential2 = new ZohoPotential("")
            {
                RowNumber = 2
            };

            var upsertResponse = new ZohoBulkUpsertRepsonse <ZohoPotential>(response, new List <ZohoPotential> {
                potential2, potential1
            });
            var resultItems = upsertResponse.Results.Select(x => x.ResponseItem).Cast <ZohoDetailsResponseItem>().ToList();

            Assert.AreNotEqual(resultItems[0].Id, resultItems[1].Id);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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 ']]>'");
        }
Exemplo n.º 4
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>"));
        }
Exemplo n.º 5
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\" />"));
        }