Exemplo n.º 1
0
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<lineitem>
    <glaccountno />
    <amount>76343.43</amount>
</lineitem>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            BillLineCreate record = new BillLineCreate();

            record.TransactionAmount = 76343.43M;

            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());
        }
Exemplo n.º 2
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>
    <item1099>true</item1099>
    <key>1234</key>
    <totalpaid>23484.93</totalpaid>
    <totaldue>0.00</totaldue>
    <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>
    <billable>true</billable>
</lineitem>";

            BillLineCreate record = new BillLineCreate()
            {
                AccountLabel          = "TestBill Account1",
                OffsetGlAccountNumber = "93590253",
                TransactionAmount     = 76343.43M,
                Memo         = "Just another memo",
                Form1099     = true,
                Key          = 1234,
                TotalPaid    = 23484.93M,
                TotalDue     = 0.00M,
                Billable     = true,
                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" }
                }
            };

            this.CompareXml(expected, record);
        }
Exemplo n.º 3
0
        public void GetXmlTest()
        {
            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>
        <termname>N30</termname>
        <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");

            record.VendorId        = "VENDOR1";
            record.TransactionDate = new DateTime(2015, 06, 30);
            record.PaymentTerm     = "N30";

            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());
        }
Exemplo n.º 4
0
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<lineitem>
    <glaccountno />
    <amount>76343.43</amount>
</lineitem>";

            BillLineCreate record = new BillLineCreate
            {
                TransactionAmount = 76343.43M
            };

            this.CompareXml(expected, record);
        }
Exemplo n.º 5
0
        public void BillLineUpdateTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <update_bill key=""1234"">
        <updatebillitems>
            <updatelineitem line_num=""1"">
                <glaccountno>7940</glaccountno>
            </updatelineitem>
            <lineitem>
                <glaccountno>4554</glaccountno>
                <amount>76343.43</amount>
            </lineitem>
        </updatebillitems>
    </update_bill>
</function>";

            BillUpdate record = new BillUpdate("unittest")
            {
                RecordNo = 1234,
            };

            BillLineUpdate line1 = new BillLineUpdate()
            {
                LineNo          = 1,
                GlAccountNumber = "7940",
            };

            record.Lines.Add(line1);

            BillLineCreate line2 = new BillLineCreate()
            {
                GlAccountNumber   = "4554",
                TransactionAmount = 76343.43M
            };

            record.Lines.Add(line2);

            this.CompareXml(expected, record);
        }
Exemplo n.º 6
0
        public void GetXmlTest()
        {
            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>
        <termname>N30</termname>
        <billitems>
            <lineitem>
                <glaccountno />
                <amount>76343.43</amount>
            </lineitem>
        </billitems>
    </create_bill>
</function>";

            BillCreate record = new BillCreate("unittest")
            {
                VendorId        = "VENDOR1",
                TransactionDate = new DateTime(2015, 06, 30),
                PaymentTerm     = "N30"
            };

            BillLineCreate line1 = new BillLineCreate
            {
                TransactionAmount = 76343.43M
            };

            record.Lines.Add(line1);

            this.CompareXml(expected, record);
        }
Exemplo n.º 7
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <update_bill key=""20394"" externalkey=""true"">
        <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>
        <billno>234</billno>
        <ponumber>234235</ponumber>
        <onhold>true</onhold>
        <description>Some description</description>
        <payto>
            <contactname>28952</contactname>
        </payto>
        <returnto>
            <contactname>289533</contactname>
        </returnto>
        <currency>USD</currency>
        <exchratedate>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </exchratedate>
        <exchratetype>Intacct Daily Rate</exchratetype>
        <supdocid>6942</supdocid>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <updatebillitems>
            <lineitem>
                <glaccountno />
                <amount>76343.43</amount>
            </lineitem>
        </updatebillitems>
    </update_bill>
</function>";

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


            BillLineCreate line1 = new BillLineCreate
            {
                TransactionAmount = 76343.43M
            };

            record.Lines.Add(line1);

            this.CompareXml(expected, record);
        }
Exemplo n.º 8
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>
    <item1099>true</item1099>
    <key>1234</key>
    <totalpaid>23484.93</totalpaid>
    <totaldue>0.00</totaldue>
    <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>
    <billable>true</billable>
</lineitem>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            BillLineCreate record = new BillLineCreate()
            {
                AccountLabel          = "TestBill Account1",
                OffsetGlAccountNumber = "93590253",
                TransactionAmount     = 76343.43M,
                Memo         = "Just another memo",
                Form1099     = true,
                Key          = 1234,
                TotalPaid    = 23484.93M,
                TotalDue     = 0.00M,
                Billable     = true,
                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());
        }
Exemplo n.º 9
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());
        }