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); }
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\" />")); }