public void InvoiceQueryRequest_ModifiedDateRange_Test() { var request = new QbXmlRequest(); var innerRequest = new InvoiceQueryRqType { ModifiedDateRangeFilter = new ModifiedDateRangeFilter { FromModifiedDate = new DATETIMETYPE(new DateTime(2014, 1, 1, 1, 2, 3)), ToModifiedDate = new DATETIMETYPE(new DateTime(2014, 1, 1, 1, 2, 3)) } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); var nameRangeFilter = requestXmlDoc.GetElementsByTagName("ModifiedDateRangeFilter"); Assert.AreEqual(1, nameRangeFilter.Count); Assert.AreEqual(innerRequest.ModifiedDateRangeFilter.FromModifiedDate.ToString(), nameRangeFilter.Item(0).ReadNode("./FromModifiedDate")); Assert.AreEqual(innerRequest.ModifiedDateRangeFilter.ToModifiedDate.ToString(), nameRangeFilter.Item(0).ReadNode("./ToModifiedDate")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void OwnerIDDataExtDefQueryRequestTest() { var request = new QbXmlRequest(); var innerRequest = new DataExtDefQueryRqType(); innerRequest.OwnerID = new List <GUIDTYPE> { Guid.NewGuid(), Guid.NewGuid() }; innerRequest.IncludeRetElement = new string[] { "ABC", "DEF" }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("DataExtDefQueryRq").Count); var node = requestXmlDoc.SelectSingleNode("//DataExtDefQueryRq"); Assert.AreEqual(2, node.SelectNodes("OwnerID").Count); var node3 = requestXmlDoc.SelectNodes("//IncludeRetElement"); Assert.AreEqual(2, node3.Count); Assert.AreEqual("ABC", node3.Item(0).InnerText); Assert.AreEqual("DEF", node3.Item(1).InnerText); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicDataExtModRequestTest() { var request = new QbXmlRequest(); var innerRequest = new DataExtModRqType(); innerRequest.DataExtMod = new DataExtMod { OwnerID = Guid.NewGuid(), DataExtName = "name", DataExtValue = "value", OtherDataExtType = OtherDataExtType.Company }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("DataExtModRq").Count); var node = requestXmlDoc.SelectSingleNode("//DataExtModRq/DataExtMod"); Assert.AreEqual(innerRequest.DataExtMod.OwnerID.ToString(), node.ReadNode("OwnerID")); Assert.AreEqual(innerRequest.DataExtMod.DataExtName, node.ReadNode("DataExtName")); Assert.AreEqual(innerRequest.DataExtMod.DataExtValue, node.ReadNode("DataExtValue")); Assert.AreEqual("Company", node.ReadNode("OtherDataExtType")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void AssignToObjectDataExtDefQueryRequestTest() { var request = new QbXmlRequest(); var innerRequest = new DataExtDefQueryRqType(); innerRequest.AssignToObject = new List<AssignToObject> { AssignToObject.Account, AssignToObject.Charge }; innerRequest.IncludeRetElement = new string[] { "ABC", "DEF" }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("DataExtDefQueryRq").Count); var node = requestXmlDoc.SelectSingleNode("//DataExtDefQueryRq"); var node2 = node.SelectNodes("AssignToObject"); Assert.AreEqual(2, node2.Count); Assert.AreEqual("Account", node2.Item(0).InnerText); Assert.AreEqual("Charge", node2.Item(1).InnerText); var node3 = requestXmlDoc.SelectNodes("//IncludeRetElement"); Assert.AreEqual(2, node3.Count); Assert.AreEqual("ABC", node3.Item(0).InnerText); Assert.AreEqual("DEF", node3.Item(1).InnerText); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void CustomerQueryRequest_FilterByNameRange_Test() { var request = new QbXmlRequest(); var innerRequest = new CustomerQueryRqType { NameRangeFilter = new NameRangeFilter { FromName = "ab", ToName = "ac" } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); var nameRangeFilter = requestXmlDoc.GetElementsByTagName("NameRangeFilter"); Assert.AreEqual(1, nameRangeFilter.Count); Assert.AreEqual(innerRequest.NameRangeFilter.FromName, nameRangeFilter.Item(0).ReadNode("./FromName")); Assert.AreEqual(innerRequest.NameRangeFilter.ToName, nameRangeFilter.Item(0).ReadNode("./ToName")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void OwnerIDDataExtDefQueryRequestTest() { var request = new QbXmlRequest(); var innerRequest = new DataExtDefQueryRqType(); innerRequest.OwnerID = new List<GUIDTYPE> { Guid.NewGuid(), Guid.NewGuid() }; innerRequest.IncludeRetElement = new string[] { "ABC", "DEF" }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("DataExtDefQueryRq").Count); var node = requestXmlDoc.SelectSingleNode("//DataExtDefQueryRq"); Assert.AreEqual(2, node.SelectNodes("OwnerID").Count); var node3 = requestXmlDoc.SelectNodes("//IncludeRetElement"); Assert.AreEqual(2, node3.Count); Assert.AreEqual("ABC", node3.Item(0).InnerText); Assert.AreEqual("DEF", node3.Item(1).InnerText); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void ListDataExtModRequestTest() { var request = new QbXmlRequest(); var innerRequest = new DataExtModRqType(); innerRequest.DataExtMod = new DataExtMod { OwnerID = Guid.NewGuid(), DataExtName = "name", DataExtValue = "value", ListDataExtType = ListDataExtType.Customer, ListObjRef = new ListObjRef { FullName = "test", ListID = "12345" } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("DataExtModRq").Count); var node = requestXmlDoc.SelectSingleNode("//DataExtModRq/DataExtMod"); Assert.AreEqual(innerRequest.DataExtMod.OwnerID.ToString(), node.ReadNode("OwnerID")); Assert.AreEqual(innerRequest.DataExtMod.DataExtName, node.ReadNode("DataExtName")); Assert.AreEqual(innerRequest.DataExtMod.DataExtValue, node.ReadNode("DataExtValue")); Assert.AreEqual("Customer", node.ReadNode("ListDataExtType")); var node2 = node.SelectSingleNode("ListObjRef"); Assert.AreEqual(innerRequest.DataExtMod.ListObjRef.FullName, node2.ReadNode("FullName")); Assert.AreEqual(innerRequest.DataExtMod.ListObjRef.ListID, node2.ReadNode("ListID")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
/// <summary> /// Returns the string that has to be sent to the Web Connector. /// Return null if your step has nothing to do this time. The next step will be executed immediately. /// </summary> /// <param name="authenticatedTicket">The authenticated ticket.</param> /// <returns>QbXml or null to execute the next step.</returns> public virtual async Task <string?> SendXMLAsync(IAuthenticatedTicket authenticatedTicket) { var requestObject = await ExecuteRequestAsync(authenticatedTicket); var requestObjectArray = requestObject?.ToArray(); if (requestObjectArray?.Any() == true) { var qbXmlRequest = new QbXmlRequest(); var list = new List <object>(requestObjectArray.Count()); foreach (var request in requestObjectArray) { list.Add(request); } qbXmlRequest.Add(new QBXMLMsgsRq { onError = await GetOnErrorAttributeAsync(authenticatedTicket), Items = list.ToArray() }); return(qbXmlRequest.GetRequest()); } return(null); }
public void LForCRCountsAsTwoCharacters() { var request = new QbXmlRequest(); var innerRequest = new CustomerAddRqType(); innerRequest.CustomerAdd = new CustomerAdd { Name = "Name", BillAddress = new BillAddress { Addr1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\nABCDEFGHIJKLMNOPQRSTUVWXYZ", // ^ is the 41st character but M should be the last character Addr2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\rABCDEFGHIJKLMNOPQRSTUVWXYZ", // ^ is the 41st character but M should be the last character Addr3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\nABCDEFGHIJKLMNOPQRSTUVWXYZ" // ^ is the 41st } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); // On Windows, \r or \n will be transformed into \r\n. Assert.AreEqual("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\nABCDEFGHIJKLM", innerRequest.CustomerAdd.BillAddress.Addr1); Assert.AreEqual("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\nABCDEFGHIJKLM", innerRequest.CustomerAdd.BillAddress.Addr2); Assert.AreEqual("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\nABCDEFGHIJKLM", innerRequest.CustomerAdd.BillAddress.Addr3); }
public void BasicItemSitesQueryRequestTests() { var request = new QbXmlRequest(); var innerRequest = new ItemSitesQueryRqType(); innerRequest.ItemSiteFilter = new ItemSiteFilter { ItemFilter = new ItemFilter { FullName = new List <string> { "NameHere" } } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("ItemSitesQueryRq").Count); Assert.AreEqual(innerRequest.ItemSiteFilter.ItemFilter.FullName.First(), requestXmlDoc.GetElementsByTagName("FullName").Item(0).InnerText); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicItemNonInventoryAddRequestTest() { var request = new QbXmlRequest(); var innerRequest = new ItemNonInventoryAddRqType(); innerRequest.ItemNonInventoryAdd = new ItemNonInventoryAdd { Name = "Something here", IsActive = true, SalesAndPurchase = new SalesAndPurchase() }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("ItemNonInventoryAddRq").Count); var node = requestXmlDoc.SelectSingleNode("//ItemNonInventoryAddRq/ItemNonInventoryAdd"); Assert.AreEqual(innerRequest.ItemNonInventoryAdd.Name, node.ReadNode("Name")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void ListDataExtAddRequestValidAfterReorder() { var request = new QbXmlRequest(); var innerRequest = new DataExtAddRqType(); innerRequest.DataExtAdd = new DataExtAdd { OwnerID = Guid.NewGuid().ToString(), DataExtName = "name", DataExtValue = "value", ListObjRef = new ListObjRef { FullName = "test", ListID = "12345" }, ListDataExtType = ListDataExtType.Customer }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void LForCRCountsAsTwoCharacters() { var request = new QbXmlRequest(); var innerRequest = new CustomerAddRqType { CustomerAdd = new CustomerAdd { Name = "Name", BillAddress = new BillAddress { Addr1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\nABCDEFGHIJKLMNOPQRSTUVWXYZ", // ^ is the 41st character but M should be the last character Addr2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\rABCDEFGHIJKLMNOPQRSTUVWXYZ", // ^ is the 41st character but M should be the last character Addr3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\nABCDEFGHIJKLMNOPQRSTUVWXYZ" // ^ is the 41st } } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); // On Windows, \r or \n will be transformed into \r\n. Assert.AreEqual("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\nABCDEFGHIJKLM", innerRequest.CustomerAdd.BillAddress.Addr1); Assert.AreEqual("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\nABCDEFGHIJKLM", innerRequest.CustomerAdd.BillAddress.Addr2); Assert.AreEqual("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\nABCDEFGHIJKLM", innerRequest.CustomerAdd.BillAddress.Addr3); }
public void TxnDataExtDelRequestTest() { var request = new QbXmlRequest(); var innerRequest = new DataExtDelRqType(); innerRequest.DataExtDel = new DataExtDel { OwnerID = Guid.NewGuid(), DataExtName = "name", TxnDataExtType = TxnDataExtType.Charge, TxnID = "123", TxnLineID = "345" }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("DataExtDelRq").Count); var node = requestXmlDoc.SelectSingleNode("//DataExtDelRq/DataExtDel"); Assert.AreEqual(innerRequest.DataExtDel.OwnerID.ToString(), node.ReadNode("OwnerID")); Assert.AreEqual(innerRequest.DataExtDel.DataExtName, node.ReadNode("DataExtName")); Assert.AreEqual("Charge", node.ReadNode("TxnDataExtType")); Assert.AreEqual(innerRequest.DataExtDel.TxnID, node.ReadNode("TxnID")); Assert.AreEqual(innerRequest.DataExtDel.TxnLineID, node.ReadNode("TxnLineID")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicInvoiceAddRequest_Order_Test() { var request = new QbXmlRequest(); var innerRequest = new InvoiceAddRqType { InvoiceAdd = new InvoiceAdd { CustomerRef = new CustomerRef { ListID = "12345" }, IsPending = true } }; var items = new List <InvoiceLineAdd>(); for (var i = 0; i < 10; i++) { items.Add(new InvoiceLineAdd { Desc = $"Test Item {i} for Test" }); items.Add(new InvoiceLineAdd { Desc = $"Another Test {i} item" }); } innerRequest.InvoiceAdd.InvoiceLineAdd = items.ToArray(); request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("InvoiceAddRq").Count); var node = requestXmlDoc.SelectSingleNode("//InvoiceAddRq/InvoiceAdd"); Assert.AreEqual(innerRequest.InvoiceAdd.CustomerRef.ListID, node.ReadNode("CustomerRef/ListID")); Assert.AreEqual(innerRequest.InvoiceAdd.IsPending.ToString(), node.ReadNode("IsPending")); var nodes2 = node.SelectNodes("InvoiceLineAdd"); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.Count(), nodes2.Count); for (var i = 0; i < 20; i += 2) { var c = i / 2; Assert.AreEqual($"Test Item {c} for Test", nodes2[i].ReadNode("Desc")); Assert.AreEqual($"Another Test {c} item", nodes2[i + 1].ReadNode("Desc")); } Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicDataExtDefModRequestTest() { var request = new QbXmlRequest(); var innerRequest = new DataExtDefModRqType(); innerRequest.DataExtDefMod = new DataExtDefMod { OwnerID = Guid.NewGuid(), DataExtName = "name", DataExtNewName = "newname", AssignToObject = new AssignToObject[] { AssignToObject.Account, AssignToObject.Charge }, RemoveFromObject = new RemoveFromObject[] { RemoveFromObject.Bill, RemoveFromObject.Check } }; innerRequest.IncludeRetElement = new string[] { "ABC", "DEF" }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("DataExtDefModRq").Count); var node = requestXmlDoc.SelectSingleNode("//DataExtDefModRq/DataExtDefMod"); Assert.AreEqual(innerRequest.DataExtDefMod.OwnerID.ToString(), node.ReadNode("OwnerID")); Assert.AreEqual(innerRequest.DataExtDefMod.DataExtName, node.ReadNode("DataExtName")); Assert.AreEqual(innerRequest.DataExtDefMod.DataExtNewName, node.ReadNode("DataExtNewName")); var node2 = node.SelectNodes("AssignToObject"); Assert.AreEqual(2, node2.Count); Assert.AreEqual("Account", node2.Item(0).InnerText); Assert.AreEqual("Charge", node2.Item(1).InnerText); var node3 = node.SelectNodes("RemoveFromObject"); Assert.AreEqual(2, node3.Count); Assert.AreEqual("Bill", node3.Item(0).InnerText); Assert.AreEqual("Check", node3.Item(1).InnerText); var node4 = requestXmlDoc.SelectNodes("//IncludeRetElement"); Assert.AreEqual(2, node4.Count); Assert.AreEqual("ABC", node4.Item(0).InnerText); Assert.AreEqual("DEF", node4.Item(1).InnerText); Assert.AreNotEqual("DataExtDefMod", node4.Item(0).ParentNode.Name); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicInvoiceModRequestTest() { var request = new QbXmlRequest(); var innerRequest = new InvoiceModRqType { InvoiceMod = new InvoiceMod { TxnID = "123", EditSequence = "456", CustomerRef = new CustomerRef { ListID = "12345" }, IsPending = true, InvoiceLineMod = new InvoiceLineMod[] { new InvoiceLineMod { TxnLineID = "1234", Desc = "Desc1" }, new InvoiceLineMod { TxnLineID = "5678", Desc = "Desc2" } } } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("InvoiceModRq").Count); var node = requestXmlDoc.SelectSingleNode("//InvoiceModRq/InvoiceMod"); Assert.AreEqual(innerRequest.InvoiceMod.TxnID, node.ReadNode("TxnID")); Assert.AreEqual(innerRequest.InvoiceMod.EditSequence, node.ReadNode("EditSequence")); Assert.AreEqual(innerRequest.InvoiceMod.CustomerRef.ListID, node.ReadNode("CustomerRef/ListID")); Assert.AreEqual(innerRequest.InvoiceMod.IsPending.ToString(), node.ReadNode("IsPending")); var nodes2 = node.SelectNodes("InvoiceLineMod"); Assert.AreEqual(innerRequest.InvoiceMod.InvoiceLineMod.Count(), nodes2.Count); Assert.AreEqual(innerRequest.InvoiceMod.InvoiceLineMod.First().TxnLineID, nodes2[0].ReadNode("TxnLineID")); Assert.AreEqual(innerRequest.InvoiceMod.InvoiceLineMod.Last().TxnLineID, nodes2[1].ReadNode("TxnLineID")); Assert.AreEqual(innerRequest.InvoiceMod.InvoiceLineMod.First().Desc, nodes2[0].ReadNode("Desc")); Assert.AreEqual(innerRequest.InvoiceMod.InvoiceLineMod.Last().Desc, nodes2[1].ReadNode("Desc")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicDataExtDefAddRequestTest() { var request = new QbXmlRequest(); var innerRequest = new DataExtDefAddRqType { DataExtDefAdd = new DataExtDefAdd { OwnerID = Guid.NewGuid(), DataExtName = "name", DataExtType = DataExtType.STR255TYPE, AssignToObject = new AssignToObject[] { AssignToObject.Account, AssignToObject.Charge } }, IncludeRetElement = new string[] { "ABC", "DEF" } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("DataExtDefAddRq").Count); var node = requestXmlDoc.SelectSingleNode("//DataExtDefAddRq/DataExtDefAdd"); Assert.AreEqual(innerRequest.DataExtDefAdd.OwnerID.ToString(), node.ReadNode("OwnerID")); Assert.AreEqual(innerRequest.DataExtDefAdd.DataExtName, node.ReadNode("DataExtName")); Assert.AreEqual(innerRequest.DataExtDefAdd.DataExtType.ToString(), node.ReadNode("DataExtType")); var node2 = node.SelectNodes("AssignToObject"); Assert.AreEqual(2, node2.Count); Assert.AreEqual("Account", node2.Item(0).InnerText); Assert.AreEqual("Charge", node2.Item(1).InnerText); var node3 = requestXmlDoc.SelectNodes("//IncludeRetElement"); Assert.AreEqual(2, node3.Count); Assert.AreEqual("ABC", node3.Item(0).InnerText); Assert.AreEqual("DEF", node3.Item(1).InnerText); Assert.AreNotEqual("DataExtDefAdd", node3.Item(0).ParentNode.Name); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicInvoiceAddRequestTest() { var request = new QbXmlRequest(); var innerRequest = new InvoiceAddRqType { InvoiceAdd = new InvoiceAdd { CustomerRef = new CustomerRef { ListID = "12345" }, IsPending = true, InvoiceLineAdd = new InvoiceLineAdd[] { new InvoiceLineAdd { Desc = "Desc1" }, new InvoiceLineAdd { Desc = "Desc2", SerialNumber = "123", } }, } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("InvoiceAddRq").Count); var node = requestXmlDoc.SelectSingleNode("//InvoiceAddRq/InvoiceAdd"); Assert.AreEqual(innerRequest.InvoiceAdd.CustomerRef.ListID, node.ReadNode("CustomerRef/ListID")); Assert.AreEqual(innerRequest.InvoiceAdd.IsPending.ToString(), node.ReadNode("IsPending")); var nodes2 = node.SelectNodes("InvoiceLineAdd"); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.Count(), nodes2.Count); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.First().Desc, nodes2[0].ReadNode("Desc")); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.Last().Desc, nodes2[1].ReadNode("Desc")); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.Last().SerialNumber, nodes2[1].ReadNode("SerialNumber")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicInvoiceModRequestTest() { var request = new QbXmlRequest(); var innerRequest = new InvoiceModRqType(); innerRequest.InvoiceMod = new InvoiceMod { TxnID = "123", EditSequence = "456", CustomerRef = new CustomerRef { ListID = "12345" }, IsPending = true, InvoiceLineMod = new InvoiceLineMod[] { new InvoiceLineMod { TxnLineID = "1234", Desc = "Desc1" }, new InvoiceLineMod { TxnLineID = "5678", Desc = "Desc2" } } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("InvoiceModRq").Count); var node = requestXmlDoc.SelectSingleNode("//InvoiceModRq/InvoiceMod"); Assert.AreEqual(innerRequest.InvoiceMod.TxnID, node.ReadNode("TxnID")); Assert.AreEqual(innerRequest.InvoiceMod.EditSequence, node.ReadNode("EditSequence")); Assert.AreEqual(innerRequest.InvoiceMod.CustomerRef.ListID, node.ReadNode("CustomerRef/ListID")); Assert.AreEqual(innerRequest.InvoiceMod.IsPending.ToString(), node.ReadNode("IsPending")); var nodes2 = node.SelectNodes("InvoiceLineMod"); Assert.AreEqual(innerRequest.InvoiceMod.InvoiceLineMod.Count(), nodes2.Count); Assert.AreEqual(innerRequest.InvoiceMod.InvoiceLineMod.First().TxnLineID, nodes2[0].ReadNode("TxnLineID")); Assert.AreEqual(innerRequest.InvoiceMod.InvoiceLineMod.Last().TxnLineID, nodes2[1].ReadNode("TxnLineID")); Assert.AreEqual(innerRequest.InvoiceMod.InvoiceLineMod.First().Desc, nodes2[0].ReadNode("Desc")); Assert.AreEqual(innerRequest.InvoiceMod.InvoiceLineMod.Last().Desc, nodes2[1].ReadNode("Desc")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicInvoiceQueryRequestTest() { var request = new QbXmlRequest(); var innerRequest = new InvoiceQueryRqType(); request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("InvoiceQueryRq").Count); Assert.AreEqual(0, requestXmlDoc.GetElementsByTagName("ListID").Count); Assert.AreEqual(0, requestXmlDoc.GetElementsByTagName("FullName").Count); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public virtual string SendXML(AuthenticatedTicket authenticatedTicket) { var requestObject = CreateRequest(authenticatedTicket); if (requestObject != null) { if (ExecuteRequest(authenticatedTicket, requestObject)) { var qbXmlRequest = new QbXmlRequest(); qbXmlRequest.AddToSingle(requestObject); return(qbXmlRequest.GetRequest()); } } return(null); }
/// <summary> /// Returns the string that has to be sent to the Web Connector. /// Return null if your step has nothing to do this time. The next step will be executed immediately. /// </summary> /// <param name="authenticatedTicket">The authenticated ticket.</param> /// <returns>QbXml or null to execute the next step.</returns> public virtual async Task <string?> SendXMLAsync(IAuthenticatedTicket authenticatedTicket) { var requestObject = await CreateRequestAsync(authenticatedTicket); if (requestObject != null) { if (await ExecuteRequestAsync(authenticatedTicket, requestObject)) { var qbXmlRequest = new QbXmlRequest(); qbXmlRequest.AddToSingle(requestObject); return(qbXmlRequest.GetRequest()); } } return(null); }
public void BasicCustomerQueryRequestWithAccentTest() { var request = new QbXmlRequest(); var innerRequest = new CustomerQueryRqType(); innerRequest.NameFilter = new NameFilter { MatchCriterion = MatchCriterion.Contains, Name = "Jean-Sébastien Goupil" }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.IsTrue(xml.Contains("Jean-Sébastien Goupil")); }
public void GuidWillOutputHexadecimalInQbXmlRequestWhenConstructedFromEmptyGuid() { var request = new QbXmlRequest(); var innerRequest = new InvoiceQueryRqType { OwnerID = new[] { new GUIDTYPE(Guid.Empty) } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual("{00000000-0000-0000-0000-000000000000}", requestXmlDoc.GetElementsByTagName("OwnerID").Item(0).InnerText); }
public void BasicInvoiceAddRequest_TooLong_Test() { var request = new QbXmlRequest(); var innerRequest = new InvoiceAddRqType { InvoiceAdd = new InvoiceAdd { CustomerRef = new CustomerRef { ListID = "12345" }, IsPending = true, InvoiceLineAdd = new InvoiceLineAdd[] { new InvoiceLineAdd { Desc = "Desc1", LotNumber = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" // 52 characters > 40 }, }, } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("InvoiceAddRq").Count); var node = requestXmlDoc.SelectSingleNode("//InvoiceAddRq/InvoiceAdd"); Assert.AreEqual(innerRequest.InvoiceAdd.CustomerRef.ListID, node.ReadNode("CustomerRef/ListID")); Assert.AreEqual(innerRequest.InvoiceAdd.IsPending.ToString(), node.ReadNode("IsPending")); var nodes2 = node.SelectNodes("InvoiceLineAdd"); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.Count(), nodes2.Count); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.First().Desc, nodes2[0].ReadNode("Desc")); Assert.AreEqual("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ".Substring(0, 40), innerRequest.InvoiceAdd.InvoiceLineAdd.First().LotNumber); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.First().LotNumber, nodes2[0].ReadNode("LotNumber")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicCustomerWhenCallingMaxReturnedMultipleTimes() { var request = new QbXmlRequest(); var innerRequest = new CustomerQueryRqType(); innerRequest.MaxReturned = "100"; innerRequest.MaxReturned = "200"; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("MaxReturned").Count); Assert.AreEqual("200", requestXmlDoc.GetElementsByTagName("MaxReturned").Item(0).InnerText); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void UTF8CharactersMustBeEncoded() { var request = new QbXmlRequest(); var innerRequest = new CustomerAddRqType(); innerRequest.CustomerAdd = new CustomerAdd { Name = "Name", Notes = "Note—1é" }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.IsTrue(xml.Contains("Note—1é")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void InvoiceQueryRequest_FilterByTxnId_Test() { var request = new QbXmlRequest(); var innerRequest = new InvoiceQueryRqType(); innerRequest.TxnID = new List<string> { "1234", "3456" }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(innerRequest.TxnID.Count(), requestXmlDoc.GetElementsByTagName("TxnID").Count); Assert.AreEqual(innerRequest.TxnID.Last(), requestXmlDoc.GetElementsByTagName("TxnID").Item(1).InnerText); Assert.AreEqual(innerRequest.TxnID.First(), requestXmlDoc.GetElementsByTagName("TxnID").Item(0).InnerText); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void SpecialCharactersMustBeEncoded() { var request = new QbXmlRequest(); var innerRequest = new CustomerAddRqType(); innerRequest.CustomerAdd = new CustomerAdd { Name = "Name", Notes = "<>'\"&é—" }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.IsTrue(xml.Contains("<>'"&é—")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicCustomerAddRequestTest() { var request = new QbXmlRequest(); var innerRequest = new CustomerAddRqType(); innerRequest.CustomerAdd = new CustomerAdd { Name = "Some Name" }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("CustomerAddRq").Count); Assert.AreEqual(innerRequest.CustomerAdd.Name, requestXmlDoc.SelectSingleNode("//CustomerAdd/Name").InnerText); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicCustomerQueryWithSomeFilters() { var request = new QbXmlRequest(); var innerRequest = new CustomerQueryRqType(); innerRequest.ActiveStatus = ActiveStatus.ActiveOnly; innerRequest.OwnerID = new GUIDTYPE[] { new GUIDTYPE(Guid.NewGuid()) }; innerRequest.MaxReturned = "100"; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("CustomerQueryRq").Count); Assert.AreEqual(0, requestXmlDoc.GetElementsByTagName("ListID").Count); Assert.AreEqual(0, requestXmlDoc.GetElementsByTagName("FullName").Count); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicCustomerAddRequest_TooLong_Test() { var request = new QbXmlRequest(); var innerRequest = new CustomerAddRqType(); innerRequest.CustomerAdd = new CustomerAdd { Name = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" // 52 characters > 41 }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("CustomerAddRq").Count); Assert.AreEqual("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ".Substring(0, 41), innerRequest.CustomerAdd.Name); Assert.AreEqual(innerRequest.CustomerAdd.Name, requestXmlDoc.SelectSingleNode("//CustomerAdd/Name").InnerText); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicCustomerQueryRequestTest() { var request = new QbXmlRequest(); var innerRequest = new CustomerQueryRqType(); request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("CustomerQueryRq").Count); Assert.AreEqual(0, requestXmlDoc.GetElementsByTagName("ListID").Count); Assert.AreEqual(0, requestXmlDoc.GetElementsByTagName("FullName").Count); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); // Make sure we have no xmlns attribute Assert.IsTrue(!xml.Contains("xmlns"), "The XML contains XMLNS. The Web Connector will reject the request."); Assert.IsTrue(xml.Contains("<?qbxml version=\"13.0\"?>"), "Version is not not included in the XML. The Web Connector will reject the request."); }
public void BasicInvoiceAddRequestTest() { var request = new QbXmlRequest(); var innerRequest = new InvoiceAddRqType(); innerRequest.InvoiceAdd = new InvoiceAdd { CustomerRef = new CustomerRef { ListID = "12345" }, IsPending = true, InvoiceLineAdd = new InvoiceLineAdd[] { new InvoiceLineAdd { Desc = "Desc1" }, new InvoiceLineAdd { Desc = "Desc2", SerialNumber = "123", } }, }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("InvoiceAddRq").Count); var node = requestXmlDoc.SelectSingleNode("//InvoiceAddRq/InvoiceAdd"); Assert.AreEqual(innerRequest.InvoiceAdd.CustomerRef.ListID, node.ReadNode("CustomerRef/ListID")); Assert.AreEqual(innerRequest.InvoiceAdd.IsPending.ToString(), node.ReadNode("IsPending")); var nodes2 = node.SelectNodes("InvoiceLineAdd"); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.Count(), nodes2.Count); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.First().Desc, nodes2[0].ReadNode("Desc")); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.Last().Desc, nodes2[1].ReadNode("Desc")); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.Last().SerialNumber, nodes2[1].ReadNode("SerialNumber")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void InvoiceQueryRequest_FilterByRefNumber_Test() { var request = new QbXmlRequest(); var innerRequest = new InvoiceQueryRqType(); innerRequest.RefNumber = new List <string> { "abc", "def" }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(innerRequest.RefNumber.Count(), requestXmlDoc.GetElementsByTagName("RefNumber").Count); Assert.AreEqual(innerRequest.RefNumber.First(), requestXmlDoc.GetElementsByTagName("RefNumber").Item(0).InnerText); Assert.AreEqual(innerRequest.RefNumber.Last(), requestXmlDoc.GetElementsByTagName("RefNumber").Item(1).InnerText); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void ListDataExtAddRequestTest() { var request = new QbXmlRequest(); var innerRequest = new DataExtAddRqType { DataExtAdd = new DataExtAdd { OwnerID = Guid.NewGuid().ToString(), DataExtName = "name", DataExtValue = "value", ListDataExtType = ListDataExtType.Customer, ListObjRef = new ListObjRef { FullName = "test", ListID = "12345" } } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("DataExtAddRq").Count); var node = requestXmlDoc.SelectSingleNode("//DataExtAddRq/DataExtAdd"); Assert.AreEqual(innerRequest.DataExtAdd.OwnerID.ToString(), node.ReadNode("OwnerID")); Assert.AreEqual(innerRequest.DataExtAdd.DataExtName, node.ReadNode("DataExtName")); Assert.AreEqual(innerRequest.DataExtAdd.DataExtValue, node.ReadNode("DataExtValue")); Assert.AreEqual("Customer", node.ReadNode("ListDataExtType")); var node2 = node.SelectSingleNode("ListObjRef"); Assert.AreEqual(innerRequest.DataExtAdd.ListObjRef.FullName, node2.ReadNode("FullName")); Assert.AreEqual(innerRequest.DataExtAdd.ListObjRef.ListID, node2.ReadNode("ListID")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void CustomerQueryRequest_FilterByFullname_Test() { var list = new List <string> { "abc", "def" }; var request = new QbXmlRequest(); var innerRequest = new CustomerQueryRqType(); innerRequest.FullName = list; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(innerRequest.FullName.Count(), requestXmlDoc.GetElementsByTagName("FullName").Count); Assert.AreEqual(list[0], requestXmlDoc.GetElementsByTagName("FullName").Item(0).InnerText); Assert.AreEqual(list[1], requestXmlDoc.GetElementsByTagName("FullName").Item(1).InnerText); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicInvoiceAddRequest_TooLong_Test() { var request = new QbXmlRequest(); var innerRequest = new InvoiceAddRqType(); innerRequest.InvoiceAdd = new InvoiceAdd { CustomerRef = new CustomerRef { ListID = "12345" }, IsPending = true, InvoiceLineAdd = new InvoiceLineAdd[] { new InvoiceLineAdd { Desc = "Desc1", LotNumber = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" // 52 characters > 40 }, }, }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("InvoiceAddRq").Count); var node = requestXmlDoc.SelectSingleNode("//InvoiceAddRq/InvoiceAdd"); Assert.AreEqual(innerRequest.InvoiceAdd.CustomerRef.ListID, node.ReadNode("CustomerRef/ListID")); Assert.AreEqual(innerRequest.InvoiceAdd.IsPending.ToString(), node.ReadNode("IsPending")); var nodes2 = node.SelectNodes("InvoiceLineAdd"); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.Count(), nodes2.Count); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.First().Desc, nodes2[0].ReadNode("Desc")); Assert.AreEqual("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ".Substring(0, 40), innerRequest.InvoiceAdd.InvoiceLineAdd.First().LotNumber); Assert.AreEqual(innerRequest.InvoiceAdd.InvoiceLineAdd.First().LotNumber, nodes2[0].ReadNode("LotNumber")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void BasicItemSitesQueryRequestTests() { var request = new QbXmlRequest(); var innerRequest = new ItemSitesQueryRqType(); innerRequest.ItemSiteFilter = new ItemSiteFilter { ItemFilter = new ItemFilter { FullName = new List<string> { "NameHere" } } }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(1, requestXmlDoc.GetElementsByTagName("ItemSitesQueryRq").Count); Assert.AreEqual(innerRequest.ItemSiteFilter.ItemFilter.FullName.First(), requestXmlDoc.GetElementsByTagName("FullName").Item(0).InnerText); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void CustomerQueryRequest_FilterByNameRange_Test() { var request = new QbXmlRequest(); var innerRequest = new CustomerQueryRqType(); innerRequest.NameRangeFilter = new NameRangeFilter { FromName = "ab", ToName = "ac" }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); var nameRangeFilter = requestXmlDoc.GetElementsByTagName("NameRangeFilter"); Assert.AreEqual(1, nameRangeFilter.Count); Assert.AreEqual(innerRequest.NameRangeFilter.FromName, nameRangeFilter.Item(0).ReadNode("./FromName")); Assert.AreEqual(innerRequest.NameRangeFilter.ToName, nameRangeFilter.Item(0).ReadNode("./ToName")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void CustomerQueryRequest_FilterByFullname_Test() { var list = new List<string> { "abc", "def" }; var request = new QbXmlRequest(); var innerRequest = new CustomerQueryRqType(); innerRequest.FullName = list; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); Assert.AreEqual(innerRequest.FullName.Count(), requestXmlDoc.GetElementsByTagName("FullName").Count); Assert.AreEqual(list[0], requestXmlDoc.GetElementsByTagName("FullName").Item(0).InnerText); Assert.AreEqual(list[1], requestXmlDoc.GetElementsByTagName("FullName").Item(1).InnerText); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }
public void InvoiceQueryRequest_ModifiedDateRange_Test() { var request = new QbXmlRequest(); var innerRequest = new InvoiceQueryRqType(); innerRequest.ModifiedDateRangeFilter = new ModifiedDateRangeFilter { FromModifiedDate = new DATETIMETYPE(new DateTime(2014, 1, 1, 1, 2, 3)), ToModifiedDate = new DATETIMETYPE(new DateTime(2014, 1, 1, 1, 2, 3)) }; request.AddToSingle(innerRequest); var xml = request.GetRequest(); XmlDocument requestXmlDoc = new XmlDocument(); requestXmlDoc.LoadXml(xml); var nameRangeFilter = requestXmlDoc.GetElementsByTagName("ModifiedDateRangeFilter"); Assert.AreEqual(1, nameRangeFilter.Count); Assert.AreEqual(innerRequest.ModifiedDateRangeFilter.FromModifiedDate.ToString(), nameRangeFilter.Item(0).ReadNode("./FromModifiedDate")); Assert.AreEqual(innerRequest.ModifiedDateRangeFilter.ToModifiedDate.ToString(), nameRangeFilter.Item(0).ReadNode("./ToModifiedDate")); Assert.IsEmpty(QuickBooksTestHelper.GetXmlValidation(xml)); }