public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<sotransitem>
    <itemid>26323</itemid>
    <quantity>2340</quantity>
</sotransitem>";

            Stream            stream      = new MemoryStream();
            XmlWriterSettings xmlSettings = new XmlWriterSettings();

            xmlSettings.Encoding    = Encoding.UTF8;
            xmlSettings.Indent      = true;
            xmlSettings.IndentChars = "    ";

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            OrderEntryTransactionLineCreate record = new OrderEntryTransactionLineCreate()
            {
                ItemId   = "26323",
                Quantity = 2340,
            };

            record.WriteXml(ref xml);

            xml.Flush();
            stream.Position = 0;
            StreamReader reader = new StreamReader(stream);

            Diff xmlDiff = DiffBuilder.Compare(expected).WithTest(reader.ReadToEnd())
                           .WithDifferenceEvaluator(DifferenceEvaluators.Default)
                           .Build();

            Assert.IsFalse(xmlDiff.HasDifferences(), xmlDiff.ToString());
        }
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_sotransaction>
        <transactiontype>Sales Order</transactiontype>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <customerid>2530</customerid>
        <sotransitems>
            <sotransitem>
                <itemid>02354032</itemid>
                <quantity>1200</quantity>
            </sotransitem>
        </sotransitems>
    </create_sotransaction>
</function>";

            Stream            stream      = new MemoryStream();
            XmlWriterSettings xmlSettings = new XmlWriterSettings();

            xmlSettings.Encoding    = Encoding.UTF8;
            xmlSettings.Indent      = true;
            xmlSettings.IndentChars = "    ";

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            OrderEntryTransactionCreate record = new OrderEntryTransactionCreate("unittest")
            {
                TransactionDefinition = "Sales Order",
                TransactionDate       = new DateTime(2015, 06, 30),
                CustomerId            = "2530",
            };

            OrderEntryTransactionLineCreate line1 = new OrderEntryTransactionLineCreate()
            {
                ItemId   = "02354032",
                Quantity = 1200,
            };

            record.Lines.Add(line1);

            record.WriteXml(ref xml);

            xml.Flush();
            stream.Position = 0;
            StreamReader reader = new StreamReader(stream);

            Diff xmlDiff = DiffBuilder.Compare(expected).WithTest(reader.ReadToEnd())
                           .WithDifferenceEvaluator(DifferenceEvaluators.Default)
                           .Build();

            Assert.IsFalse(xmlDiff.HasDifferences(), xmlDiff.ToString());
        }
Ejemplo n.º 3
0
        public void SubtotalEntryTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <update_sotransaction key=""Sales Order-SO0001"">
        <updatesotransitems>
            <updatesotransitem line_num=""1"">
                <itemid>02354032</itemid>
                <quantity>12</quantity>
            </updatesotransitem>
            <sotransitem>
                <itemid>02354032</itemid>
                <quantity>1200</quantity>
            </sotransitem>
        </updatesotransitems>
        <updatesubtotals>
            <updatesubtotal>
                <description>Subtotal Description</description>
                <total>1200</total>
            </updatesubtotal>
        </updatesubtotals>
    </update_sotransaction>
</function>";

            OrderEntryTransactionUpdate record = new OrderEntryTransactionUpdate("unittest")
            {
                TransactionId = "Sales Order-SO0001",
            };

            OrderEntryTransactionLineUpdate line1 = new OrderEntryTransactionLineUpdate()
            {
                LineNo   = 1,
                ItemId   = "02354032",
                Quantity = 12,
            };

            record.Lines.Add(line1);

            OrderEntryTransactionLineCreate line2 = new OrderEntryTransactionLineCreate()
            {
                ItemId   = "02354032",
                Quantity = 1200,
            };

            record.Lines.Add(line2);

            TransactionSubtotalUpdate subtotal1 = new TransactionSubtotalUpdate()
            {
                Description = "Subtotal Description",
                Total       = 1200,
            };

            record.Subtotals.Add(subtotal1);

            this.CompareXml(expected, record);
        }
        public void SubtotalEntryTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_sotransaction>
        <transactiontype>Sales Order</transactiontype>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <customerid>2530</customerid>
        <sotransitems>
            <sotransitem>
                <itemid>02354032</itemid>
                <quantity>1200</quantity>
            </sotransitem>
        </sotransitems>
        <subtotals>
            <subtotal>
                <description>Subtotal Description</description>
                <total>1200</total>
            </subtotal>
        </subtotals>
    </create_sotransaction>
</function>";

            OrderEntryTransactionCreate record = new OrderEntryTransactionCreate("unittest")
            {
                TransactionDefinition = "Sales Order",
                TransactionDate       = new DateTime(2015, 06, 30),
                CustomerId            = "2530",
            };

            OrderEntryTransactionLineCreate line1 = new OrderEntryTransactionLineCreate()
            {
                ItemId   = "02354032",
                Quantity = 1200,
            };

            record.Lines.Add(line1);

            TransactionSubtotalCreate subtotal1 = new TransactionSubtotalCreate()
            {
                Description = "Subtotal Description",
                Total       = 1200,
            };

            record.Subtotals.Add(subtotal1);

            this.CompareXml(expected, record);
        }
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<sotransitem>
    <itemid>26323</itemid>
    <quantity>2340</quantity>
</sotransitem>";

            OrderEntryTransactionLineCreate record = new OrderEntryTransactionLineCreate()
            {
                ItemId   = "26323",
                Quantity = 2340,
            };

            this.CompareXml(expected, record);
        }
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<sotransitem>
    <bundlenumber>092304</bundlenumber>
    <itemid>26323</itemid>
    <itemdesc>Item Description</itemdesc>
    <taxable>true</taxable>
    <warehouseid>93294</warehouseid>
    <quantity>2340</quantity>
    <unit>593</unit>
    <linelevelsimpletaxtype>Test</linelevelsimpletaxtype>
    <discountpercent>10.00</discountpercent>
    <price>32.35</price>
    <discsurchargememo>None</discsurchargememo>
    <locationid>SF</locationid>
    <departmentid>Receiving</departmentid>
    <memo>Memo</memo>
    <itemdetails>
        <itemdetail>
            <quantity>52</quantity>
            <lotno>3243</lotno>
        </itemdetail>
    </itemdetails>
    <customfields>
        <customfield>
            <customfieldname>customfield1</customfieldname>
            <customfieldvalue>customvalue1</customfieldvalue>
        </customfield>
    </customfields>
    <revrectemplate>template</revrectemplate>
    <revrecstartdate>
        <year>2015</year>
        <month>06</month>
        <day>30</day>
    </revrecstartdate>
    <revrecenddate>
        <year>2015</year>
        <month>07</month>
        <day>31</day>
    </revrecenddate>
    <renewalmacro>Quarterly</renewalmacro>
    <projectid>235</projectid>
    <customerid>23423434</customerid>
    <vendorid>797656</vendorid>
    <employeeid>90295</employeeid>
    <classid>243609</classid>
    <contractid>9062</contractid>
    <fulfillmentstatus>Complete</fulfillmentstatus>
    <taskno>9850</taskno>
    <billingtemplate>3525</billingtemplate>
</sotransitem>";

            OrderEntryTransactionLineCreate record = new OrderEntryTransactionLineCreate()
            {
                BundleNumber           = "092304",
                ItemId                 = "26323",
                ItemDescription        = "Item Description",
                Taxable                = true,
                WarehouseId            = "93294",
                Quantity               = 2340,
                Unit                   = "593",
                LineLevelSimpleTaxType = "Test",
                DiscountPercent        = 10.00M,
                Price                  = 32.35M,
                DiscountSurchargeMemo  = "None",
                Memo                   = "Memo",
                RevRecTemplate         = "template",
                RevRecStartDate        = new DateTime(2015, 06, 30),
                RevRecEndDate          = new DateTime(2015, 07, 31),
                RenewalMacro           = "Quarterly",
                FulfillmentStatus      = "Complete",
                TaskNumber             = "9850",
                BillingTemplate        = "3525",
                LocationId             = "SF",
                DepartmentId           = "Receiving",
                ProjectId              = "235",
                CustomerId             = "23423434",
                VendorId               = "797656",
                EmployeeId             = "90295",
                ClassId                = "243609",
                ContractId             = "9062",
                CustomFields           = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

            TransactionItemDetail detail1 = new TransactionItemDetail()
            {
                Quantity  = 52,
                LotNumber = "3243",
            };

            record.ItemDetails.Add(detail1);

            this.CompareXml(expected, record);
        }
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_sotransaction>
        <transactiontype>Sales Order</transactiontype>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <dateposted>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </dateposted>
        <createdfrom>Sales Quote-Q1002</createdfrom>
        <customerid>23530</customerid>
        <documentno>23430</documentno>
        <origdocdate>
            <year>2015</year>
            <month>06</month>
            <day>15</day>
        </origdocdate>
        <referenceno>234235</referenceno>
        <termname>N30</termname>
        <datedue>
            <year>2020</year>
            <month>09</month>
            <day>24</day>
        </datedue>
        <message>Submit</message>
        <shippingmethod>USPS</shippingmethod>
        <shipto>
            <contactname>28952</contactname>
        </shipto>
        <billto>
            <contactname>289533</contactname>
        </billto>
        <supdocid>6942</supdocid>
        <externalid>20394</externalid>
        <basecurr>USD</basecurr>
        <currency>USD</currency>
        <exchratedate>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </exchratedate>
        <exchratetype>Intacct Daily Rate</exchratetype>
        <vsoepricelist>VSOEPricing</vsoepricelist>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <state>Pending</state>
        <projectid>P2904</projectid>
        <sotransitems>
            <sotransitem>
                <itemid>2390552</itemid>
                <quantity>223</quantity>
            </sotransitem>
        </sotransitems>
        <subtotals>
            <subtotal>
                <description>Subtotal description</description>
                <total>223</total>
            </subtotal>
        </subtotals>
    </create_sotransaction>
</function>";

            Stream            stream      = new MemoryStream();
            XmlWriterSettings xmlSettings = new XmlWriterSettings();

            xmlSettings.Encoding    = Encoding.UTF8;
            xmlSettings.Indent      = true;
            xmlSettings.IndentChars = "    ";

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            OrderEntryTransactionCreate record = new OrderEntryTransactionCreate("unittest")
            {
                TransactionDefinition = "Sales Order",
                TransactionDate       = new DateTime(2015, 06, 30),
                GlPostingDate         = new DateTime(2015, 06, 30),
                CreatedFrom           = "Sales Quote-Q1002",
                CustomerId            = "23530",
                DocumentNumber        = "23430",
                OriginalDocumentDate  = new DateTime(2015, 06, 15),
                ReferenceNumber       = "234235",
                PaymentTerm           = "N30",
                DueDate             = new DateTime(2020, 09, 24),
                Message             = "Submit",
                ShippingMethod      = "USPS",
                ShipToContactName   = "28952",
                BillToContactName   = "289533",
                AttachmentsId       = "6942",
                ExternalId          = "20394",
                BaseCurrency        = "USD",
                TransactionCurrency = "USD",
                ExchangeRateDate    = new DateTime(2015, 06, 30),
                ExchangeRateType    = "Intacct Daily Rate",
                VsoePriceList       = "VSOEPricing",
                State        = "Pending",
                ProjectId    = "P2904",
                CustomFields = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

            OrderEntryTransactionLineCreate line1 = new OrderEntryTransactionLineCreate()
            {
                ItemId   = "2390552",
                Quantity = 223,
            };

            record.Lines.Add(line1);

            TransactionSubtotalCreate subtotal1 = new TransactionSubtotalCreate()
            {
                Description = "Subtotal description",
                Total       = 223,
            };

            record.Subtotals.Add(subtotal1);

            record.WriteXml(ref xml);

            xml.Flush();
            stream.Position = 0;
            StreamReader reader = new StreamReader(stream);

            Diff xmlDiff = DiffBuilder.Compare(expected).WithTest(reader.ReadToEnd())
                           .WithDifferenceEvaluator(DifferenceEvaluators.Default)
                           .Build();

            Assert.IsFalse(xmlDiff.HasDifferences(), xmlDiff.ToString());
        }
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<sotransitem>
    <bundlenumber>092304</bundlenumber>
    <itemid>26323</itemid>
    <itemdesc>Item Description</itemdesc>
    <taxable>true</taxable>
    <warehouseid>93294</warehouseid>
    <quantity>2340</quantity>
    <unit>593</unit>
    <discountpercent>10.00</discountpercent>
    <price>32.35</price>
    <discsurchargememo>None</discsurchargememo>
    <locationid>SF</locationid>
    <departmentid>Receiving</departmentid>
    <memo>Memo</memo>
    <itemdetails>
        <itemdetail>
            <quantity>52</quantity>
            <lotno>3243</lotno>
        </itemdetail>
    </itemdetails>
    <customfields>
        <customfield>
            <customfieldname>customfield1</customfieldname>
            <customfieldvalue>customvalue1</customfieldvalue>
        </customfield>
    </customfields>
    <revrectemplate>template</revrectemplate>
    <revrecstartdate>
        <year>2015</year>
        <month>06</month>
        <day>30</day>
    </revrecstartdate>
    <revrecenddate>
        <year>2015</year>
        <month>07</month>
        <day>31</day>
    </revrecenddate>
    <renewalmacro>Quarterly</renewalmacro>
    <projectid>235</projectid>
    <customerid>23423434</customerid>
    <vendorid>797656</vendorid>
    <employeeid>90295</employeeid>
    <classid>243609</classid>
    <contractid>9062</contractid>
    <fulfillmentstatus>Complete</fulfillmentstatus>
    <taskno>9850</taskno>
    <billingtemplate>3525</billingtemplate>
</sotransitem>";

            Stream            stream      = new MemoryStream();
            XmlWriterSettings xmlSettings = new XmlWriterSettings();

            xmlSettings.Encoding    = Encoding.UTF8;
            xmlSettings.Indent      = true;
            xmlSettings.IndentChars = "    ";

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            OrderEntryTransactionLineCreate record = new OrderEntryTransactionLineCreate()
            {
                BundleNumber          = "092304",
                ItemId                = "26323",
                ItemDescription       = "Item Description",
                Taxable               = true,
                WarehouseId           = "93294",
                Quantity              = 2340,
                Unit                  = "593",
                DiscountPercent       = 10.00M,
                Price                 = 32.35M,
                DiscountSurchargeMemo = "None",
                Memo                  = "Memo",
                RevRecTemplate        = "template",
                RevRecStartDate       = new DateTime(2015, 06, 30),
                RevRecEndDate         = new DateTime(2015, 07, 31),
                RenewalMacro          = "Quarterly",
                FulfillmentStatus     = "Complete",
                TaskNumber            = "9850",
                BillingTemplate       = "3525",
                LocationId            = "SF",
                DepartmentId          = "Receiving",
                ProjectId             = "235",
                CustomerId            = "23423434",
                VendorId              = "797656",
                EmployeeId            = "90295",
                ClassId               = "243609",
                ContractId            = "9062",
                CustomFields          = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

            TransactionItemDetail detail1 = new TransactionItemDetail()
            {
                Quantity  = 52,
                LotNumber = "3243",
            };

            record.ItemDetails.Add(detail1);

            record.WriteXml(ref xml);

            xml.Flush();
            stream.Position = 0;
            StreamReader reader = new StreamReader(stream);

            Diff xmlDiff = DiffBuilder.Compare(expected).WithTest(reader.ReadToEnd())
                           .WithDifferenceEvaluator(DifferenceEvaluators.Default)
                           .Build();

            Assert.IsFalse(xmlDiff.HasDifferences(), xmlDiff.ToString());
        }
        public void SubtotalEntryTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <update_sotransaction key=""Sales Order-SO0001"">
        <updatesotransitems>
            <updatesotransitem line_num=""1"">
                <itemid>02354032</itemid>
                <quantity>12</quantity>
            </updatesotransitem>
            <sotransitem>
                <itemid>02354032</itemid>
                <quantity>1200</quantity>
            </sotransitem>
        </updatesotransitems>
        <updatesubtotals>
            <updatesubtotal>
                <description>Subtotal Description</description>
                <total>1200</total>
            </updatesubtotal>
        </updatesubtotals>
    </update_sotransaction>
</function>";

            Stream            stream      = new MemoryStream();
            XmlWriterSettings xmlSettings = new XmlWriterSettings();

            xmlSettings.Encoding    = Encoding.UTF8;
            xmlSettings.Indent      = true;
            xmlSettings.IndentChars = "    ";

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            OrderEntryTransactionUpdate record = new OrderEntryTransactionUpdate("unittest")
            {
                TransactionId = "Sales Order-SO0001",
            };

            OrderEntryTransactionLineUpdate line1 = new OrderEntryTransactionLineUpdate()
            {
                LineNo   = 1,
                ItemId   = "02354032",
                Quantity = 12,
            };

            record.Lines.Add(line1);

            OrderEntryTransactionLineCreate line2 = new OrderEntryTransactionLineCreate()
            {
                ItemId   = "02354032",
                Quantity = 1200,
            };

            record.Lines.Add(line2);

            TransactionSubtotalUpdate subtotal1 = new TransactionSubtotalUpdate()
            {
                Description = "Subtotal Description",
                Total       = 1200,
            };

            record.Subtotals.Add(subtotal1);

            record.WriteXml(ref xml);

            xml.Flush();
            stream.Position = 0;
            StreamReader reader = new StreamReader(stream);

            Diff xmlDiff = DiffBuilder.Compare(expected).WithTest(reader.ReadToEnd())
                           .WithDifferenceEvaluator(DifferenceEvaluators.Default)
                           .Build();

            Assert.IsFalse(xmlDiff.HasDifferences(), xmlDiff.ToString());
        }
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_sotransaction>
        <transactiontype>Sales Order</transactiontype>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <dateposted>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </dateposted>
        <createdfrom>Sales Quote-Q1002</createdfrom>
        <customerid>23530</customerid>
        <documentno>23430</documentno>
        <origdocdate>
            <year>2015</year>
            <month>06</month>
            <day>15</day>
        </origdocdate>
        <referenceno>234235</referenceno>
        <termname>N30</termname>
        <datedue>
            <year>2020</year>
            <month>09</month>
            <day>24</day>
        </datedue>
        <message>Submit</message>
        <shippingmethod>USPS</shippingmethod>
        <shipto>
            <contactname>28952</contactname>
        </shipto>
        <billto>
            <contactname>289533</contactname>
        </billto>
        <supdocid>6942</supdocid>
        <externalid>20394</externalid>
        <basecurr>USD</basecurr>
        <currency>USD</currency>
        <exchratedate>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </exchratedate>
        <exchratetype>Intacct Daily Rate</exchratetype>
        <vsoepricelist>VSOEPricing</vsoepricelist>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <state>Pending</state>
        <projectid>P2904</projectid>
        <sotransitems>
            <sotransitem>
                <itemid>2390552</itemid>
                <quantity>223</quantity>
            </sotransitem>
        </sotransitems>
        <subtotals>
            <subtotal>
                <description>Subtotal description</description>
                <total>223</total>
            </subtotal>
        </subtotals>
    </create_sotransaction>
</function>";

            OrderEntryTransactionCreate record = new OrderEntryTransactionCreate("unittest")
            {
                TransactionDefinition = "Sales Order",
                TransactionDate       = new DateTime(2015, 06, 30),
                GlPostingDate         = new DateTime(2015, 06, 30),
                CreatedFrom           = "Sales Quote-Q1002",
                CustomerId            = "23530",
                DocumentNumber        = "23430",
                OriginalDocumentDate  = new DateTime(2015, 06, 15),
                ReferenceNumber       = "234235",
                PaymentTerm           = "N30",
                DueDate             = new DateTime(2020, 09, 24),
                Message             = "Submit",
                ShippingMethod      = "USPS",
                ShipToContactName   = "28952",
                BillToContactName   = "289533",
                AttachmentsId       = "6942",
                ExternalId          = "20394",
                BaseCurrency        = "USD",
                TransactionCurrency = "USD",
                ExchangeRateDate    = new DateTime(2015, 06, 30),
                ExchangeRateType    = "Intacct Daily Rate",
                VsoePriceList       = "VSOEPricing",
                State        = "Pending",
                ProjectId    = "P2904",
                CustomFields = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

            OrderEntryTransactionLineCreate line1 = new OrderEntryTransactionLineCreate()
            {
                ItemId   = "2390552",
                Quantity = 223,
            };

            record.Lines.Add(line1);

            TransactionSubtotalCreate subtotal1 = new TransactionSubtotalCreate()
            {
                Description = "Subtotal description",
                Total       = 223,
            };

            record.Subtotals.Add(subtotal1);

            this.CompareXml(expected, record);
        }