public void AddUpdateMessage_adds_new_message() { var qbxmlBase = new QBXMLBaseChild(); qbxmlBase.AddUpdateMessage("MaxReturned", "20"); var expected = new XElement("ClassQueryRq", new XElement("MaxReturned", "20")); AssertXmlAreEqual(expected, qbxmlBase.Xml); }
public void AddUpdateMessage_doesnt_add_message_if_last_value_is_null() { var qbxmlBase = new QBXMLBaseChild(); qbxmlBase.AddUpdateMessage("MaxReturned", "20"); qbxmlBase.AddUpdateMessage("ListID", null); var expected = new XElement("ClassQueryRq", new XElement("MaxReturned", "20")); AssertXmlAreEqual(expected, qbxmlBase.Xml); }
public void ConvertObjectArrayToXElement_two_elements() { var expected = new XElement("MaxReturned", "20"); var actual = new QBXMLBaseChild() .ConvertObjectArrayToXElement( new List <object>() { "MaxReturned", "20" }); AssertXmlAreEqual(expected, actual); }
public void ConvertObjectArrayToXElement_converts_bool_to_string() { var expected = new XElement("ClassQueryRq", new XElement("IsActive", "true")); var actual = new QBXMLBaseChild() .ConvertObjectArrayToXElement( new List <object>() { "ClassQueryRq", "IsActive", true }); AssertXmlAreEqual(expected, actual); }
public void AddMessageAllowDuplicates_adds_duplicate_message() { var qbxmlBase = new QBXMLBaseChild(); qbxmlBase.AddMessageAllowDuplicates("MaxReturned", "20"); qbxmlBase.AddMessageAllowDuplicates("MaxReturned", "40"); var expected = new XElement("ClassQueryRq", new XElement("MaxReturned", "20"), new XElement("MaxReturned", "40")); AssertXmlAreEqual(expected, qbxmlBase.Xml); }
public void ConvertObjectArrayToXElement_converts_DateTime_to_XMLVersionOfDateTime() { var expected = new XElement("ClassQueryRq", new XElement("AccountFilter", new XElement("AccountOpenDate", "2009-01-01"))); var actual = new QBXMLBaseChild() .ConvertObjectArrayToXElement( new List <object>() { "ClassQueryRq", "AccountFilter", "AccountOpenDate", new DateTime(2009, 1, 1) }); AssertXmlAreEqual(expected, actual); }
public void ConvertObjectArrayToXElement_converts_decimal_to_string() { var expected = new XElement("ClassQueryRq", new XElement("AccountFilter", new XElement("AccountBalance", "20.22"))); var actual = new QBXMLBaseChild() .ConvertObjectArrayToXElement( new List <object>() { "ClassQueryRq", "AccountFilter", "AccountBalance", (decimal)20.22 }); AssertXmlAreEqual(expected, actual); }
public void ConvertObjectArrayToXElement_four_elements() { var expected = new XElement("ClassQueryRq", new XElement("AccountFilter", new XElement("AccountFullName", "Yoder, Paul"))); var actual = new QBXMLBaseChild() .ConvertObjectArrayToXElement( new List <object>() { "ClassQueryRq", "AccountFilter", "AccountFullName", "Yoder, Paul" }); AssertXmlAreEqual(expected, actual); }
public void XMLtoPOCOList() { var xml = new XElement("ClassQueryRs", new XElement("ClassRet", new XElement("ListID", "123"), new XElement("Name", "Yoder, Paul")), new XElement("ClassRet", new XElement("ListID", "456"), new XElement("Name", "Buffett, Warren"))); var pocoList = new QBXMLBaseChild().XMLtoPOCOList(xml); Assert.AreEqual(2, pocoList.Count, "Count"); Assert.AreEqual("123", pocoList[0].ListID, "ListID"); Assert.AreEqual("Buffett, Warren", pocoList[1].Name, "Name"); }
public void AddUpdateMessage_parentXML_doesnt_add_message_if_last_value_is_null() { var qbxmlBase = new QBXMLBaseChild(); var xml = new XElement("ClassQueryRq"); var order = new ElementPosition("ClassQueryRq", "MaxReturned", "ListID"); qbxmlBase.AddUpdateMessage(xml, order, "MaxReturned", null); qbxmlBase.AddUpdateMessage(xml, order, "ListID", 22); var expected = new XElement("ClassQueryRq", new XElement("ListID", "22")); AssertXmlAreEqual(expected, xml); }