예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public void ConvertObjectArrayToXElement_two_elements()
        {
            var expected = new XElement("MaxReturned", "20");
            var actual   = new QBXMLBaseChild()
                           .ConvertObjectArrayToXElement(
                new List <object>()
            {
                "MaxReturned", "20"
            });

            AssertXmlAreEqual(expected, actual);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        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);
        }
예제 #9
0
        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");
        }
예제 #10
0
        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);
        }