예제 #1
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<lineitem>
    <accountlabel>TestBill Account1</accountlabel>
    <amount>76343.43</amount>
    <memo>Just another memo</memo>
    <locationid>Location1</locationid>
    <departmentid>Department1</departmentid>
    <customfields>
        <customfield>
            <customfieldname>customfield1</customfieldname>
            <customfieldvalue>customvalue1</customfieldvalue>
        </customfield>
    </customfields>
    <projectid>Project1</projectid>
    <customerid>Customer1</customerid>
    <vendorid>Vendor1</vendorid>
    <employeeid>Employee1</employeeid>
    <itemid>Item1</itemid>
    <classid>Class1</classid>
    <contractid>Contract1</contractid>
    <warehouseid>Warehouse1</warehouseid>
</lineitem>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);


            OtherReceiptLineCreate line = new OtherReceiptLineCreate();

            line.AccountLabel      = "TestBill Account1";
            line.TransactionAmount = 76343.43M;
            line.Memo         = "Just another memo";
            line.LocationId   = "Location1";
            line.DepartmentId = "Department1";
            line.ProjectId    = "Project1";
            line.CustomerId   = "Customer1";
            line.VendorId     = "Vendor1";
            line.EmployeeId   = "Employee1";
            line.ItemId       = "Item1";
            line.ClassId      = "Class1";
            line.ContractId   = "Contract1";
            line.WarehouseId  = "Warehouse1";

            line.CustomFields = new Dictionary <string, dynamic>
            {
                { "customfield1", "customvalue1" }
            };

            line.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());
        }
예제 #2
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <consolidate>
        <bookid>USD Books</bookid>
        <reportingperiodname>Month Ended June 2016</reportingperiodname>
        <offline>true</offline>
        <updatesucceedingperiods>false</updatesucceedingperiods>
        <changesonly>true</changesonly>
        <email>[email protected]</email>
        <entities>
            <csnentity>
                <entityid>VT</entityid>
                <bsrate>0.0000483500</bsrate>
                <warate>0.0000485851</warate>
            </csnentity>
        </entities>
    </consolidate>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ConsolidationCreate rate = new ConsolidationCreate("unittest")
            {
                ReportingBookId         = "USD Books",
                ReportingPeriodName     = "Month Ended June 2016",
                ProcessOffline          = true,
                ChangesOnly             = true,
                UpdateSucceedingPeriods = false,
                NotificationEmail       = "*****@*****.**",
            };


            ConsolidationEntity entity = new ConsolidationEntity();

            entity.EntityId            = "VT";
            entity.EndingSpotRate      = 0.0000483500M;
            entity.WeightedAverageRate = 0.0000485851M;

            rate.Entities.Add(entity);

            rate.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());
        }
예제 #4
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<lineitem>
    <accountlabel>TestBill Account1</accountlabel>
    <offsetglaccountno>93590253</offsetglaccountno>
    <amount>76343.43</amount>
    <memo>Just another memo</memo>
    <locationid>Location1</locationid>
    <departmentid>Department1</departmentid>
    <key>1234</key>
    <totalpaid>23484.93</totalpaid>
    <totaldue>0.00</totaldue>
    <customfields>
        <customfield>
            <customfieldname>customfield1</customfieldname>
            <customfieldvalue>customvalue1</customfieldvalue>
        </customfield>
    </customfields>
    <revrectemplate>RevRec1</revrectemplate>
    <defrevaccount>2100</defrevaccount>
    <revrecstartdate>
        <year>2016</year>
        <month>06</month>
        <day>01</day>
    </revrecstartdate>
    <revrecenddate>
        <year>2017</year>
        <month>05</month>
        <day>31</day>
    </revrecenddate>
    <projectid>Project1</projectid>
    <customerid>Customer1</customerid>
    <vendorid>Vendor1</vendorid>
    <employeeid>Employee1</employeeid>
    <itemid>Item1</itemid>
    <classid>Class1</classid>
    <contractid>Contract1</contractid>
    <warehouseid>Warehouse1</warehouseid>
</lineitem>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            InvoiceLineCreate record = new InvoiceLineCreate()
            {
                AccountLabel          = "TestBill Account1",
                OffsetGlAccountNumber = "93590253",
                TransactionAmount     = 76343.43M,
                Memo                   = "Just another memo",
                Key                    = 1234,
                TotalPaid              = 23484.93M,
                TotalDue               = 0.00M,
                RevRecTemplateId       = "RevRec1",
                DeferredRevGlAccountNo = "2100",
                RevRecStartDate        = new DateTime(2016, 06, 01),
                RevRecEndDate          = new DateTime(2017, 05, 31),
                LocationId             = "Location1",
                DepartmentId           = "Department1",
                ProjectId              = "Project1",
                CustomerId             = "Customer1",
                VendorId               = "Vendor1",
                EmployeeId             = "Employee1",
                ItemId                 = "Item1",
                ClassId                = "Class1",
                ContractId             = "Contract1",
                WarehouseId            = "Warehouse1",
                CustomFields           = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

            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());
        }
예제 #5
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_ictransaction>
        <transactiontype>Inventory Shipper</transactiontype>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <createdfrom>Inventory Shipper-P1002</createdfrom>
        <documentno>23430</documentno>
        <referenceno>234235</referenceno>
        <message>Submit</message>
        <externalid>20394</externalid>
        <basecurr>USD</basecurr>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <state>Pending</state>
        <ictransitems>
            <ictransitem>
                <itemid>2390552</itemid>
                <warehouseid>W1234</warehouseid>
                <quantity>223</quantity>
            </ictransitem>
        </ictransitems>
        <subtotals>
            <subtotal>
                <description>Subtotal description</description>
                <total>223</total>
            </subtotal>
        </subtotals>
    </create_ictransaction>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            InventoryTransactionCreate record = new InventoryTransactionCreate("unittest")
            {
                TransactionDefinition = "Inventory Shipper",
                TransactionDate       = new DateTime(2015, 06, 30),
                CreatedFrom           = "Inventory Shipper-P1002",
                DocumentNumber        = "23430",
                ReferenceNumber       = "234235",
                Message      = "Submit",
                ExternalId   = "20394",
                BaseCurrency = "USD",
                State        = "Pending",
                CustomFields = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

            InventoryTransactionLineCreate line1 = new InventoryTransactionLineCreate()
            {
                ItemId      = "2390552",
                WarehouseId = "W1234",
                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());
        }
예제 #6
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<expenseadjustment>
    <glaccountno>7000</glaccountno>
    <amount>1025.99</amount>
    <currency>USD</currency>
    <trx_amount>76343.43</trx_amount>
    <exchratedate>
        <year>2016</year>
        <month>06</month>
        <day>30</day>
    </exchratedate>
    <exchratetype>Intacct Daily Rate</exchratetype>
    <expensedate>
        <year>2016</year>
        <month>06</month>
        <day>30</day>
    </expensedate>
    <memo>Marriott</memo>
    <locationid>Location1</locationid>
    <departmentid>Department1</departmentid>
    <projectid>Project1</projectid>
    <customerid>Customer1</customerid>
    <vendorid>Vendor1</vendorid>
    <employeeid>Employee1</employeeid>
    <itemid>Item1</itemid>
    <classid>Class1</classid>
    <contractid>Contract1</contractid>
    <warehouseid>Warehouse1</warehouseid>
    <billable>true</billable>
    <exppmttype>AMEX</exppmttype>
    <quantity>10</quantity>
    <rate>12.34</rate>
    <customfields>
        <customfield>
            <customfieldname>customfield1</customfieldname>
            <customfieldvalue>customvalue1</customfieldvalue>
        </customfield>
    </customfields>
</expenseadjustment>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ExpenseAdjustmentLineCreate record = new ExpenseAdjustmentLineCreate()
            {
                GlAccountNumber     = "7000",
                ReimbursementAmount = 1025.99M,
                TransactionCurrency = "USD",
                TransactionAmount   = 76343.43M,
                ExchangeRateDate    = new DateTime(2016, 06, 30),
                ExchangeRateType    = "Intacct Daily Rate",
                ExpenseDate         = new DateTime(2016, 06, 30),
                Memo            = "Marriott",
                Billable        = true,
                PaymentTypeName = "AMEX",
                Quantity        = 10,
                UnitRate        = 12.34M,
                LocationId      = "Location1",
                DepartmentId    = "Department1",
                ProjectId       = "Project1",
                CustomerId      = "Customer1",
                VendorId        = "Vendor1",
                EmployeeId      = "Employee1",
                ItemId          = "Item1",
                ClassId         = "Class1",
                ContractId      = "Contract1",
                WarehouseId     = "Warehouse1",
                CustomFields    = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

            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>";

            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());
        }
예제 #8
0
        public void RestrictionsTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create>
        <USERINFO>
            <LOGINID>U1234</LOGINID>
            <USERTYPE>business user</USERTYPE>
            <CONTACTINFO>
                <LASTNAME>Last</LASTNAME>
                <FIRSTNAME>First</FIRSTNAME>
                <EMAIL1>[email protected]</EMAIL1>
            </CONTACTINFO>
            <USERLOCATIONS>
                <LOCATIONID>E100</LOCATIONID>
            </USERLOCATIONS>
            <USERLOCATIONS>
                <LOCATIONID>E200</LOCATIONID>
            </USERLOCATIONS>
            <USERDEPARTMENTS>
                <DEPARTMENTID>D100</DEPARTMENTID>
            </USERDEPARTMENTS>
            <USERDEPARTMENTS>
                <DEPARTMENTID>D200</DEPARTMENTID>
            </USERDEPARTMENTS>
        </USERINFO>
    </create>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            UserCreate record = new UserCreate("unittest");

            record.UserId              = "U1234";
            record.UserType            = "business user";
            record.LastName            = "Last";
            record.FirstName           = "First";
            record.PrimaryEmailAddress = "*****@*****.**";
            record.RestrictedEntities  = new List <string> {
                "E100",
                "E200",
            };
            record.RestrictedDepartments = new List <string> {
                "D100",
                "D200",
            };

            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 GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_potransaction>
        <transactiontype>Purchase Order</transactiontype>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <vendorid>2530</vendorid>
        <datedue>
            <year>2019</year>
            <month>09</month>
            <day>15</day>
        </datedue>
        <returnto>
            <contactname />
        </returnto>
        <payto>
            <contactname />
        </payto>
        <potransitems>
            <potransitem>
                <itemid>02354032</itemid>
                <quantity>1200</quantity>
            </potransitem>
        </potransitems>
    </create_potransaction>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            PurchasingTransactionCreate record = new PurchasingTransactionCreate("unittest")
            {
                TransactionDefinition = "Purchase Order",
                TransactionDate       = new DateTime(2015, 06, 30),
                VendorId = "2530",
                DueDate  = new DateTime(2019, 09, 15),
            };

            PurchasingTransactionLineCreate line1 = new PurchasingTransactionLineCreate()
            {
                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());
        }
예제 #11
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <record_deposit>
        <bankaccountid>BA1145</bankaccountid>
        <depositdate>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </depositdate>
        <depositid>Deposit Slip 2015-06-30</depositid>
        <receiptkeys>
            <receiptkey>1234</receiptkey>
        </receiptkeys>
        <description>Desc</description>
        <supdocid>AT111</supdocid>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
    </record_deposit>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            DepositCreate record = new DepositCreate("unittest");

            record.BankAccountId             = "BA1145";
            record.DepositDate               = new DateTime(2015, 06, 30);
            record.DepositSlipId             = "Deposit Slip 2015-06-30";
            record.Description               = "Desc";
            record.AttachmentsId             = "AT111";
            record.TransactionsKeysToDeposit = new List <int>()
            {
                1234
            };
            record.CustomFields = new Dictionary <string, dynamic>
            {
                { "customfield1", "customvalue1" }
            };

            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""?>
<ictransitem>
    <itemid>26323</itemid>
    <itemdesc>Item Description</itemdesc>
    <warehouseid>93294</warehouseid>
    <quantity>2340</quantity>
    <unit>593</unit>
    <cost>32.35</cost>
    <locationid>SF</locationid>
    <departmentid>Purchasing</departmentid>
    <itemdetails>
        <itemdetail>
            <quantity>52</quantity>
            <lotno>3243</lotno>
        </itemdetail>
    </itemdetails>
    <customfields>
        <customfield>
            <customfieldname>customfield1</customfieldname>
            <customfieldvalue>customvalue1</customfieldvalue>
        </customfield>
    </customfields>
    <projectid>235</projectid>
    <customerid>23423434</customerid>
    <vendorid>797656</vendorid>
    <employeeid>90295</employeeid>
    <classid>243609</classid>
    <contractid>9062</contractid>
</ictransitem>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            InventoryTransactionLineCreate record = new InventoryTransactionLineCreate()
            {
                ItemId          = "26323",
                ItemDescription = "Item Description",
                WarehouseId     = "93294",
                Quantity        = 2340,
                Unit            = "593",
                Cost            = 32.35M,
                LocationId      = "SF",
                DepartmentId    = "Purchasing",
                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());
        }
예제 #13
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <update>
        <CUSTOMER>
            <CUSTOMERID>C1234</CUSTOMERID>
            <NAME>Intacct Corp</NAME>
            <DISPLAYCONTACT>
                <PRINTAS>Intacct Corporation</PRINTAS>
                <COMPANYNAME>Intacct Corp.</COMPANYNAME>
                <TAXABLE>true</TAXABLE>
                <TAXGROUP>CA</TAXGROUP>
                <PREFIX>Mr</PREFIX>
                <FIRSTNAME>Bill</FIRSTNAME>
                <LASTNAME>Smith</LASTNAME>
                <INITIAL>G</INITIAL>
                <PHONE1>12</PHONE1>
                <PHONE2>34</PHONE2>
                <CELLPHONE>56</CELLPHONE>
                <PAGER>78</PAGER>
                <FAX>90</FAX>
                <EMAIL1>[email protected]</EMAIL1>
                <EMAIL2>[email protected]</EMAIL2>
                <URL1>www.intacct.com</URL1>
                <URL2>us.intacct.com</URL2>
                <MAILADDRESS>
                    <ADDRESS1>300 Park Ave</ADDRESS1>
                    <ADDRESS2>Ste 1400</ADDRESS2>
                    <CITY>San Jose</CITY>
                    <STATE>CA</STATE>
                    <ZIP>95110</ZIP>
                    <COUNTRY>United States</COUNTRY>
                </MAILADDRESS>
            </DISPLAYCONTACT>
            <ONETIME>false</ONETIME>
            <STATUS>active</STATUS>
            <HIDEDISPLAYCONTACT>false</HIDEDISPLAYCONTACT>
            <CUSTTYPE>SaaS</CUSTTYPE>
            <PARENTID>C5678</PARENTID>
            <GLGROUP>Group</GLGROUP>
            <TERRITORYID>NE</TERRITORYID>
            <SUPDOCID>A1234</SUPDOCID>
            <TERMNAME>N30</TERMNAME>
            <OFFSETGLACCOUNTNO>1200</OFFSETGLACCOUNTNO>
            <ARACCOUNT>4000</ARACCOUNT>
            <SHIPPINGMETHOD>USPS</SHIPPINGMETHOD>
            <RESALENO>123</RESALENO>
            <TAXID>12-3456789</TAXID>
            <CREDITLIMIT>1234.56</CREDITLIMIT>
            <ONHOLD>false</ONHOLD>
            <DELIVERYOPTIONS>Print#~#E-Mail</DELIVERYOPTIONS>
            <CUSTMESSAGEID>hello</CUSTMESSAGEID>
            <COMMENTS>my comment</COMMENTS>
            <CURRENCY>USD</CURRENCY>
            <ARINVOICEPRINTTEMPLATEID>temp1</ARINVOICEPRINTTEMPLATEID>
            <OEQUOTEPRINTTEMPLATEID>temp2</OEQUOTEPRINTTEMPLATEID>
            <OEORDERPRINTTEMPLATEID>temp3</OEORDERPRINTTEMPLATEID>
            <OELISTPRINTTEMPLATEID>temp4</OELISTPRINTTEMPLATEID>
            <OEINVOICEPRINTTEMPLATEID>temp5</OEINVOICEPRINTTEMPLATEID>
            <OEADJPRINTTEMPLATEID>temp6</OEADJPRINTTEMPLATEID>
            <OEOTHERPRINTTEMPLATEID>temp7</OEOTHERPRINTTEMPLATEID>
            <CONTACTINFO>
                <CONTACTNAME>primary</CONTACTNAME>
            </CONTACTINFO>
            <BILLTO>
                <CONTACTNAME>bill to</CONTACTNAME>
            </BILLTO>
            <SHIPTO>
                <CONTACTNAME>ship to</CONTACTNAME>
            </SHIPTO>
            <OBJECTRESTRICTION>Restricted</OBJECTRESTRICTION>
            <RESTRICTEDLOCATIONS>100#~#200</RESTRICTEDLOCATIONS>
            <RESTRICTEDDEPARTMENTS>D100#~#D200</RESTRICTEDDEPARTMENTS>
            <CUSTOMFIELD1>Hello</CUSTOMFIELD1>
        </CUSTOMER>
    </update>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            CustomerUpdate record = new CustomerUpdate("unittest")
            {
                CustomerId            = "C1234",
                CustomerName          = "Intacct Corp",
                PrintAs               = "Intacct Corporation",
                CompanyName           = "Intacct Corp.",
                Taxable               = true,
                TaxId                 = "12-3456789",
                ContactTaxGroupName   = "CA",
                Prefix                = "Mr",
                FirstName             = "Bill",
                LastName              = "Smith",
                MiddleName            = "G",
                PrimaryPhoneNo        = "12",
                SecondaryPhoneNo      = "34",
                CellularPhoneNo       = "56",
                PagerNo               = "78",
                FaxNo                 = "90",
                PrimaryEmailAddress   = "*****@*****.**",
                SecondaryEmailAddress = "*****@*****.**",
                PrimaryUrl            = "www.intacct.com",
                SecondaryUrl          = "us.intacct.com",
                AddressLine1          = "300 Park Ave",
                AddressLine2          = "Ste 1400",
                City                                = "San Jose",
                StateProvince                       = "CA",
                ZipPostalCode                       = "95110",
                Country                             = "United States",
                OneTime                             = false,
                Active                              = true,
                ExcludedFromContactList             = false,
                CustomerTypeId                      = "SaaS",
                ParentCustomerId                    = "C5678",
                GlGroupName                         = "Group",
                TerritoryId                         = "NE",
                AttachmentsId                       = "A1234",
                PaymentTerm                         = "N30",
                OffsetArGlAccountNo                 = "1200",
                DefaultRevenueGlAccountNo           = "4000",
                ShippingMethod                      = "USPS",
                ResaleNumber                        = "123",
                CreditLimit                         = 1234.56M,
                OnHold                              = false,
                DeliveryMethod                      = "Print#~#E-Mail",
                DefaultInvoiceMessage               = "hello",
                Comments                            = "my comment",
                DefaultCurrency                     = "USD",
                PrintOptionArInvoiceTemplateName    = "temp1",
                PrintOptionOeQuoteTemplateName      = "temp2",
                PrintOptionOeOrderTemplateName      = "temp3",
                PrintOptionOeListTemplateName       = "temp4",
                PrintOptionOeInvoiceTemplateName    = "temp5",
                PrintOptionOeAdjustmentTemplateName = "temp6",
                PrintOptionOeOtherTemplateName      = "temp7",
                PrimaryContactName                  = "primary",
                BillToContactName                   = "bill to",
                ShipToContactName                   = "ship to",
                RestrictionType                     = "Restricted",
                RestrictedLocations                 = new List <string>()
                {
                    "100",
                    "200",
                },
                RestrictedDepartments = new List <string>()
                {
                    "D100",
                    "D200",
                },
                CustomFields = new Dictionary <string, dynamic>
                {
                    { "CUSTOMFIELD1", "Hello" }
                }
            };

            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());
        }
예제 #14
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <update>
        <VENDOR>
            <VENDORID>V1234</VENDORID>
            <NAME>Intacct Corp</NAME>
            <DISPLAYCONTACT>
                <PRINTAS>Intacct Corporation</PRINTAS>
                <COMPANYNAME>Intacct Corp.</COMPANYNAME>
                <TAXABLE>true</TAXABLE>
                <TAXGROUP>CA</TAXGROUP>
                <PREFIX>Mr</PREFIX>
                <FIRSTNAME>Bill</FIRSTNAME>
                <LASTNAME>Smith</LASTNAME>
                <INITIAL>G</INITIAL>
                <PHONE1>12</PHONE1>
                <PHONE2>34</PHONE2>
                <CELLPHONE>56</CELLPHONE>
                <PAGER>78</PAGER>
                <FAX>90</FAX>
                <EMAIL1>[email protected]</EMAIL1>
                <EMAIL2>[email protected]</EMAIL2>
                <URL1>www.intacct.com</URL1>
                <URL2>us.intacct.com</URL2>
                <MAILADDRESS>
                    <ADDRESS1>300 Park Ave</ADDRESS1>
                    <ADDRESS2>Ste 1400</ADDRESS2>
                    <CITY>San Jose</CITY>
                    <STATE>CA</STATE>
                    <ZIP>95110</ZIP>
                    <COUNTRY>United States</COUNTRY>
                </MAILADDRESS>
            </DISPLAYCONTACT>
            <ONETIME>false</ONETIME>
            <STATUS>active</STATUS>
            <HIDEDISPLAYCONTACT>false</HIDEDISPLAYCONTACT>
            <VENDTYPE>SaaS</VENDTYPE>
            <PARENTID>V5678</PARENTID>
            <GLGROUP>Group</GLGROUP>
            <TAXID>12-3456789</TAXID>
            <NAME1099>INTACCT CORP</NAME1099>
            <FORM1099TYPE>MISC</FORM1099TYPE>
            <FORM1099BOX>3</FORM1099BOX>
            <SUPDOCID>A1234</SUPDOCID>
            <APACCOUNT>2000</APACCOUNT>
            <CREDITLIMIT>1234.56</CREDITLIMIT>
            <ONHOLD>false</ONHOLD>
            <DONOTCUTCHECK>false</DONOTCUTCHECK>
            <COMMENTS>my comment</COMMENTS>
            <CURRENCY>USD</CURRENCY>
            <CONTACTINFO>
                <CONTACTNAME>primary</CONTACTNAME>
            </CONTACTINFO>
            <PAYTO>
                <CONTACTNAME>pay to</CONTACTNAME>
            </PAYTO>
            <RETURNTO>
                <CONTACTNAME>return to</CONTACTNAME>
            </RETURNTO>
            <PAYMETHODKEY>Printed Check</PAYMETHODKEY>
            <MERGEPAYMENTREQ>true</MERGEPAYMENTREQ>
            <PAYMENTNOTIFY>true</PAYMENTNOTIFY>
            <BILLINGTYPE>openitem</BILLINGTYPE>
            <PAYMENTPRIORITY>Normal</PAYMENTPRIORITY>
            <TERMNAME>N30</TERMNAME>
            <DISPLAYTERMDISCOUNT>false</DISPLAYTERMDISCOUNT>
            <ACHENABLED>true</ACHENABLED>
            <ACHBANKROUTINGNUMBER>123456789</ACHBANKROUTINGNUMBER>
            <ACHACCOUNTNUMBER>1111222233334444</ACHACCOUNTNUMBER>
            <ACHACCOUNTTYPE>Checking Account</ACHACCOUNTTYPE>
            <ACHREMITTANCETYPE>CTX</ACHREMITTANCETYPE>
            <VENDORACCOUNTNO>9999999</VENDORACCOUNTNO>
            <DISPLAYACCTNOCHECK>false</DISPLAYACCTNOCHECK>
            <OBJECTRESTRICTION>Restricted</OBJECTRESTRICTION>
            <RESTRICTEDLOCATIONS>100#~#200</RESTRICTEDLOCATIONS>
            <RESTRICTEDDEPARTMENTS>D100#~#D200</RESTRICTEDDEPARTMENTS>
            <CUSTOMFIELD1>Hello</CUSTOMFIELD1>
        </VENDOR>
    </update>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            VendorUpdate record = new VendorUpdate("unittest")
            {
                VendorId              = "V1234",
                VendorName            = "Intacct Corp",
                PrintAs               = "Intacct Corporation",
                CompanyName           = "Intacct Corp.",
                Taxable               = true,
                TaxId                 = "12-3456789",
                ContactTaxGroupName   = "CA",
                Prefix                = "Mr",
                FirstName             = "Bill",
                LastName              = "Smith",
                MiddleName            = "G",
                PrimaryPhoneNo        = "12",
                SecondaryPhoneNo      = "34",
                CellularPhoneNo       = "56",
                PagerNo               = "78",
                FaxNo                 = "90",
                PrimaryEmailAddress   = "*****@*****.**",
                SecondaryEmailAddress = "*****@*****.**",
                PrimaryUrl            = "www.intacct.com",
                SecondaryUrl          = "us.intacct.com",
                AddressLine1          = "300 Park Ave",
                AddressLine2          = "Ste 1400",
                City                             = "San Jose",
                StateProvince                    = "CA",
                ZipPostalCode                    = "95110",
                Country                          = "United States",
                OneTime                          = false,
                Active                           = true,
                ExcludedFromContactList          = false,
                VendorTypeId                     = "SaaS",
                ParentVendorId                   = "V5678",
                GlGroupName                      = "Group",
                Form1099Name                     = "INTACCT CORP",
                Form1099Type                     = "MISC",
                Form1099Box                      = "3",
                AttachmentsId                    = "A1234",
                DefaultExpenseGlAccountNo        = "2000",
                CreditLimit                      = 1234.56M,
                OnHold                           = false,
                DoNotPay                         = false,
                Comments                         = "my comment",
                DefaultCurrency                  = "USD",
                PrimaryContactName               = "primary",
                PayToContactName                 = "pay to",
                ReturnToContactName              = "return to",
                PreferredPaymentMethod           = "Printed Check",
                MergePaymentRequests             = true,
                SendAutomaticPaymentNotification = true,
                VendorBillingType                = "openitem",
                PaymentPriority                  = "Normal",
                PaymentTerm                      = "N30",
                TermDiscountDisplayedOnCheckStub = false,
                AchEnabled                       = true,
                AchBankRoutingNo                 = "123456789",
                AchBankAccountNo                 = "1111222233334444",
                AchBankAccountType               = "Checking Account",
                AchBankAccountClass              = "CTX",
                VendorAccountNo                  = "9999999",
                LocationAssignedAccountNoDisplayedOnCheckStub = false,
                RestrictionType     = "Restricted",
                RestrictedLocations = new List <string>()
                {
                    "100",
                    "200",
                },
                RestrictedDepartments = new List <string>()
                {
                    "D100",
                    "D200",
                },
                CustomFields = new Dictionary <string, dynamic>
                {
                    { "CUSTOMFIELD1", "Hello" }
                }
            };

            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());
        }
예제 #15
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<GLENTRY>
    <DOCUMENT>212</DOCUMENT>
    <ACCOUNTNO>9000</ACCOUNTNO>
    <TR_TYPE>1</TR_TYPE>
    <TRX_AMOUNT>1456.54</TRX_AMOUNT>
    <LOCATION>100</LOCATION>
    <DEPARTMENT>ADM</DEPARTMENT>
    <PROJECTID>P100</PROJECTID>
    <CUSTOMERID>C100</CUSTOMERID>
    <VENDORID>V100</VENDORID>
    <EMPLOYEEID>E100</EMPLOYEEID>
    <ITEMID>I100</ITEMID>
    <CLASSID>C200</CLASSID>
    <CONTRACTID>C300</CONTRACTID>
    <WAREHOUSEID>W100</WAREHOUSEID>
    <DESCRIPTION>my memo</DESCRIPTION>
    <CUSTOM01>123</CUSTOM01>
</GLENTRY>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            StatisticalJournalEntryLineCreate record = new StatisticalJournalEntryLineCreate()
            {
                DocumentNumber    = "212",
                StatAccountNumber = "9000",
                Amount            = 1456.54M,
                Memo         = "my memo",
                LocationId   = "100",
                DepartmentId = "ADM",
                ProjectId    = "P100",
                CustomerId   = "C100",
                VendorId     = "V100",
                EmployeeId   = "E100",
                ItemId       = "I100",
                ClassId      = "C200",
                ContractId   = "C300",
                WarehouseId  = "W100",
                CustomFields = new Dictionary <string, dynamic>
                {
                    { "CUSTOM01", "123" }
                }
            };

            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());
        }
예제 #16
0
        public void DefaultParamsTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<logical logical_operator=""and"">
    <expression>
        <field>recordno</field>
        <operator>&gt;=</operator>
        <value>1234</value>
    </expression>
    <logical logical_operator=""or"">
        <expression>
            <field>ownerobject</field>
            <operator>=</operator>
            <value>PROJECT</value>
        </expression>
        <expression>
            <field>ownerobject</field>
            <operator>=</operator>
            <value>CUSTOMER</value>
        </expression>
    </logical>
</logical>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ExpressionFilter exp1 = new ExpressionFilter();

            exp1.FieldName = "recordno";
            exp1.Operator  = ExpressionFilter.OperatorGreaterThanOrEqualTo;
            exp1.Value     = "1234";

            ExpressionFilter exp2 = new ExpressionFilter();

            exp2.FieldName = "ownerobject";
            exp2.Operator  = ExpressionFilter.OperatorEqualTo;
            exp2.Value     = "PROJECT";

            ExpressionFilter exp3 = new ExpressionFilter();

            exp3.FieldName = "ownerobject";
            exp3.Operator  = ExpressionFilter.OperatorEqualTo;
            exp3.Value     = "CUSTOMER";

            LogicalFilter logical2 = new LogicalFilter();

            logical2.Operator = LogicalFilter.OperatorOr;
            logical2.Filters.Add(exp2);
            logical2.Filters.Add(exp3);

            LogicalFilter logical1 = new LogicalFilter();

            logical1.Operator = LogicalFilter.OperatorAnd;
            logical1.Filters.Add(exp1);
            logical1.Filters.Add(logical2);

            logical1.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());
        }
예제 #17
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create>
        <GLBATCH>
            <JOURNAL>GJ</JOURNAL>
            <BATCH_DATE>06/30/2016</BATCH_DATE>
            <REVERSEDATE>07/01/2016</REVERSEDATE>
            <BATCH_TITLE>My desc</BATCH_TITLE>
            <HISTORY_COMMENT>comment!</HISTORY_COMMENT>
            <REFERENCENO>123</REFERENCENO>
            <BASELOCATION_NO>100</BASELOCATION_NO>
            <SUPDOCID>AT001</SUPDOCID>
            <STATE>Posted</STATE>
            <CUSTOMFIELD01>test01</CUSTOMFIELD01>
            <ENTRIES>
                <GLENTRY>
                    <ACCOUNTNO />
                    <TR_TYPE>1</TR_TYPE>
                    <TRX_AMOUNT />
                </GLENTRY>
                <GLENTRY>
                    <ACCOUNTNO />
                    <TR_TYPE>1</TR_TYPE>
                    <TRX_AMOUNT />
                </GLENTRY>
            </ENTRIES>
        </GLBATCH>
    </create>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            JournalEntryCreate record = new JournalEntryCreate("unittest")
            {
                JournalSymbol   = "GJ",
                PostingDate     = new DateTime(2016, 06, 30),
                ReverseDate     = new DateTime(2016, 07, 01),
                Description     = "My desc",
                HistoryComment  = "comment!",
                ReferenceNumber = "123",
                AttachmentsId   = "AT001",
                Action          = "Posted",
                SourceEntityId  = "100",
                CustomFields    = new Dictionary <string, dynamic>
                {
                    { "CUSTOMFIELD01", "test01" }
                },
            };

            JournalEntryLineCreate line1 = new JournalEntryLineCreate();
            JournalEntryLineCreate line2 = new JournalEntryLineCreate();

            record.Lines.Add(line1);
            record.Lines.Add(line2);

            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"">
    <record_cctransaction>
        <chargecardid>AMEX1234</chargecardid>
        <paymentdate>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </paymentdate>
        <referenceno>321</referenceno>
        <payee>Costco</payee>
        <description>Supplies</description>
        <supdocid>A1234</supdocid>
        <currency>USD</currency>
        <exchratedate>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </exchratedate>
        <exchratetype>Intacct Daily Rate</exchratetype>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <ccpayitems>
            <ccpayitem>
                <glaccountno />
                <paymentamount>76343.43</paymentamount>
            </ccpayitem>
        </ccpayitems>
    </record_cctransaction>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ChargeCardTransactionCreate record = new ChargeCardTransactionCreate("unittest");

            record.ChargeCardId        = "AMEX1234";
            record.TransactionDate     = new DateTime(2015, 06, 30);
            record.ReferenceNumber     = "321";
            record.Payee               = "Costco";
            record.Description         = "Supplies";
            record.AttachmentsId       = "A1234";
            record.TransactionCurrency = "USD";
            record.ExchangeRateDate    = new DateTime(2015, 06, 30);
            record.ExchangeRateType    = "Intacct Daily Rate";
            record.CustomFields        = new Dictionary <string, dynamic>
            {
                { "customfield1", "customvalue1" }
            };

            ChargeCardTransactionLineCreate line = new ChargeCardTransactionLineCreate();

            line.TransactionAmount = 76343.43M;

            record.Lines.Add(line);

            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());
        }
예제 #19
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_bill>
        <vendorid>VENDOR1</vendorid>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <dateposted>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </dateposted>
        <datedue>
            <year>2020</year>
            <month>09</month>
            <day>24</day>
        </datedue>
        <termname>N30</termname>
        <action>Submit</action>
        <batchkey>20323</batchkey>
        <billno>234</billno>
        <ponumber>234235</ponumber>
        <onhold>true</onhold>
        <description>Some description</description>
        <externalid>20394</externalid>
        <payto>
            <contactname>28952</contactname>
        </payto>
        <returnto>
            <contactname>289533</contactname>
        </returnto>
        <basecurr>USD</basecurr>
        <currency>USD</currency>
        <exchratedate>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </exchratedate>
        <exchratetype>Intacct Daily Rate</exchratetype>
        <nogl>false</nogl>
        <supdocid>6942</supdocid>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <billitems>
            <lineitem>
                <glaccountno />
                <amount>76343.43</amount>
            </lineitem>
        </billitems>
    </create_bill>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            BillCreate record = new BillCreate("unittest")
            {
                VendorId            = "VENDOR1",
                TransactionDate     = new DateTime(2015, 06, 30),
                GlPostingDate       = new DateTime(2015, 06, 30),
                DueDate             = new DateTime(2020, 09, 24),
                PaymentTerm         = "N30",
                Action              = "Submit",
                SummaryRecordNo     = 20323,
                BillNumber          = "234",
                ReferenceNumber     = "234235",
                OnHold              = true,
                Description         = "Some description",
                ExternalId          = "20394",
                PayToContactName    = "28952",
                ReturnToContactName = "289533",
                BaseCurrency        = "USD",
                TransactionCurrency = "USD",
                ExchangeRateDate    = new DateTime(2015, 06, 30),
                ExchangeRateType    = "Intacct Daily Rate",
                DoNotPostToGL       = false,
                AttachmentsId       = "6942",
                CustomFields        = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                },
            };


            BillLineCreate line1 = new BillLineCreate();

            line1.TransactionAmount = 76343.43M;

            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());
        }
예제 #20
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create>
        <TIMESHEET>
            <EMPLOYEEID>E1234</EMPLOYEEID>
            <BEGINDATE>06/30/2016</BEGINDATE>
            <DESCRIPTION>desc</DESCRIPTION>
            <SUPDOCID>A1234</SUPDOCID>
            <STATE>Submitted</STATE>
            <TIMESHEETENTRIES>
                <TIMESHEETENTRY>
                    <ENTRYDATE>06/30/2016</ENTRYDATE>
                    <QTY>1.75</QTY>
                </TIMESHEETENTRY>
            </TIMESHEETENTRIES>
            <customfield1>customvalue1</customfield1>
        </TIMESHEET>
    </create>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            TimesheetCreate record = new TimesheetCreate("unittest");

            record.EmployeeId    = "E1234";
            record.BeginDate     = new DateTime(2016, 06, 30);
            record.Description   = "desc";
            record.AttachmentsId = "A1234";
            record.Action        = "Submitted";
            record.CustomFields  = new Dictionary <string, dynamic>
            {
                { "customfield1", "customvalue1" }
            };

            TimesheetEntryCreate entry = new TimesheetEntryCreate();

            entry.EntryDate = new DateTime(2016, 06, 30);
            entry.Quantity  = 1.75M;

            record.Entries.Add(entry);

            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"">
    <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>";

            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);

            TransactionSubtotalCreate subtotal1 = new TransactionSubtotalCreate()
            {
                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());
        }
예제 #22
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_paymentrequest>
        <bankaccountid>BA1143</bankaccountid>
        <vendorid>V0001</vendorid>
        <memo>Memo</memo>
        <paymentmethod>Printed Check</paymentmethod>
        <grouppayments>true</grouppayments>
        <paymentdate>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </paymentdate>
        <paymentoption>vendorpref</paymentoption>
        <paymentrequestitems>
            <paymentrequestitem>
                <key>123</key>
                <paymentamount>100.12</paymentamount>
                <credittoapply>8.12</credittoapply>
                <discounttoapply>1.21</discounttoapply>
            </paymentrequestitem>
        </paymentrequestitems>
        <documentnumber>10000</documentnumber>
        <paymentdescription>Memo</paymentdescription>
        <paymentcontact>Jim Smith</paymentcontact>
    </create_paymentrequest>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ApPaymentRequestCreate record = new ApPaymentRequestCreate("unittest")
            {
                BankAccountId           = "BA1143",
                VendorId                = "V0001",
                Memo                    = "Memo",
                PaymentMethod           = AbstractApPaymentRequest.PaymentMethodCheck,
                GroupPayments           = true,
                PaymentDate             = new DateTime(2015, 06, 30),
                MergeOption             = "vendorpref",
                DocumentNo              = "10000",
                NotificationContactName = "Jim Smith",
            };

            ApPaymentRequestItem line1 = new ApPaymentRequestItem()
            {
                ApplyToRecordId = 123,
                AmountToApply   = 100.12M,
                CreditToApply   = 8.12M,
                DiscountToApply = 1.21M,
            };

            record.ApplyToTransactions.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());
        }
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_expensereport>
        <employeeid>E0001</employeeid>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <dateposted>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </dateposted>
        <batchkey>123</batchkey>
        <expensereportno>ER001</expensereportno>
        <state>Submitted</state>
        <description>For hotel</description>
        <memo>Memo</memo>
        <externalid>122</externalid>
        <basecurr>USD</basecurr>
        <currency>USD</currency>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <supdocid>AT122</supdocid>
        <expenses>
            <expense>
                <glaccountno />
            </expense>
        </expenses>
    </create_expensereport>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ExpenseReportCreate record = new ExpenseReportCreate("unittest")
            {
                EmployeeId          = "E0001",
                TransactionDate     = new DateTime(2015, 06, 30),
                GlPostingDate       = new DateTime(2015, 06, 30),
                SummaryRecordNo     = 123,
                ExpenseReportNumber = "ER001",
                Action                = "Submitted",
                ReasonForExpense      = "For hotel",
                Memo                  = "Memo",
                ExternalId            = "122",
                BaseCurrency          = "USD",
                ReimbursementCurrency = "USD",
                AttachmentsId         = "AT122",
                CustomFields          = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                },
            };


            ExpenseReportLineCreate line1 = new ExpenseReportLineCreate();

            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());
        }
예제 #24
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<subtotal>
    <description>Subtotal Description</description>
    <total>4202</total>
    <percentval>9.2</percentval>
    <locationid>2355</locationid>
    <departmentid>RCVNG</departmentid>
    <projectid>FOW</projectid>
    <customerid>CUST5893</customerid>
    <vendorid>VEN53222</vendorid>
    <employeeid>EM5925</employeeid>
    <classid>CLS322</classid>
    <itemid>I5266235</itemid>
    <contractid>C23662</contractid>
    <customfields>
        <customfield>
            <customfieldname>customfield1</customfieldname>
            <customfieldvalue>customvalue1</customfieldvalue>
        </customfield>
    </customfields>
</subtotal>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            TransactionSubtotalCreate record = new TransactionSubtotalCreate()
            {
                Description     = "Subtotal Description",
                Total           = 4202,
                PercentageValue = 9.2M,
                LocationId      = "2355",
                DepartmentId    = "RCVNG",
                ProjectId       = "FOW",
                CustomerId      = "CUST5893",
                VendorId        = "VEN53222",
                EmployeeId      = "EM5925",
                ClassId         = "CLS322",
                ItemId          = "I5266235",
                ContractId      = "C23662",
                CustomFields    = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

            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());
        }
예제 #25
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<TIMESHEETENTRY>
    <ENTRYDATE>06/30/2016</ENTRYDATE>
    <QTY>1.75</QTY>
    <DESCRIPTION>desc</DESCRIPTION>
    <NOTES>my note</NOTES>
    <TASKKEY>1234</TASKKEY>
    <TIMETYPE>Salary</TIMETYPE>
    <BILLABLE>true</BILLABLE>
    <EXTBILLRATE>200</EXTBILLRATE>
    <EXTCOSTRATE>175</EXTCOSTRATE>
    <DEPARTMENTID>ADM</DEPARTMENTID>
    <LOCATIONID>100</LOCATIONID>
    <PROJECTID>P100</PROJECTID>
    <CUSTOMERID>C100</CUSTOMERID>
    <VENDORID>V100</VENDORID>
    <ITEMID>I100</ITEMID>
    <CLASSID>C200</CLASSID>
    <CONTRACTID>C300</CONTRACTID>
    <WAREHOUSEID>W100</WAREHOUSEID>
    <customfield1>customvalue1</customfield1>
</TIMESHEETENTRY>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            TimesheetEntryCreate entry = new TimesheetEntryCreate();

            entry.EntryDate             = new DateTime(2016, 06, 30);
            entry.Quantity              = 1.75M;
            entry.Description           = "desc";
            entry.Notes                 = "my note";
            entry.TaskRecordNo          = 1234;
            entry.TimeTypeName          = "Salary";
            entry.Billable              = true;
            entry.OverrideBillingRate   = 200;
            entry.OverrideLaborCostRate = 175;
            entry.DepartmentId          = "ADM";
            entry.LocationId            = "100";
            entry.ProjectId             = "P100";
            entry.CustomerId            = "C100";
            entry.VendorId              = "V100";
            entry.ItemId                = "I100";
            entry.ClassId               = "C200";
            entry.ContractId            = "C300";
            entry.WarehouseId           = "W100";
            entry.CustomFields          = new Dictionary <string, dynamic>
            {
                { "customfield1", "customvalue1" }
            };

            entry.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_aradjustment>
        <customerid>CUSTOMER1</customerid>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <dateposted>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </dateposted>
        <batchkey>20323</batchkey>
        <adjustmentno>234</adjustmentno>
        <action>Submit</action>
        <invoiceno>234235</invoiceno>
        <description>Some description</description>
        <externalid>20394</externalid>
        <basecurr>USD</basecurr>
        <currency>USD</currency>
        <exchratedate>
            <year>2016</year>
            <month>06</month>
            <day>30</day>
        </exchratedate>
        <exchratetype>Intacct Daily Rate</exchratetype>
        <nogl>false</nogl>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <aradjustmentitems>
            <lineitem>
                <glaccountno />
                <amount>76343.43</amount>
            </lineitem>
        </aradjustmentitems>
    </create_aradjustment>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ArAdjustmentCreate record = new ArAdjustmentCreate("unittest")
            {
                CustomerId          = "CUSTOMER1",
                TransactionDate     = new DateTime(2015, 06, 30),
                GlPostingDate       = new DateTime(2015, 06, 30),
                SummaryRecordNo     = "20323",
                AdjustmentNumber    = "234",
                Action              = "Submit",
                InvoiceNumber       = "234235",
                Description         = "Some description",
                ExternalId          = "20394",
                BaseCurrency        = "USD",
                TransactionCurrency = "USD",
                ExchangeRateDate    = new DateTime(2016, 06, 30),
                ExchangeRateType    = "Intacct Daily Rate",
                DoNotPostToGL       = false,
                CustomFields        = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                },
            };

            ArAdjustmentLineCreate line1 = new ArAdjustmentLineCreate();

            line1.TransactionAmount = 76343.43M;

            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());
        }