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

            ApAdjustmentLineCreate record = new ApAdjustmentLineCreate()
            {
                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());
        }
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_apadjustment>
        <vendorid>VENDOR1</vendorid>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <apadjustmentitems>
            <lineitem>
                <glaccountno />
                <amount>76343.43</amount>
            </lineitem>
        </apadjustmentitems>
    </create_apadjustment>
</function>";

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

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

            record.Lines.Add(line1);

            this.CompareXml(expected, record);
        }
        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>Key1</key>
    <totalpaid>23484.93</totalpaid>
    <totaldue>0.0</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>
    <warehouseid>Warehouse1</warehouseid>
</lineitem>";

            ApAdjustmentLineCreate record = new ApAdjustmentLineCreate()
            {
                AccountLabel          = "TestBill Account1",
                OffsetGlAccountNumber = "93590253",
                TransactionAmount     = 76343.43M,
                Memo         = "Just another memo",
                Key          = "Key1",
                TotalPaid    = 23484.93M,
                TotalDue     = 0.0M,
                LocationId   = "Location1",
                DepartmentId = "Department1",
                ProjectId    = "Project1",
                CustomerId   = "Customer1",
                VendorId     = "Vendor1",
                EmployeeId   = "Employee1",
                ItemId       = "Item1",
                ClassId      = "Class1",
                WarehouseId  = "Warehouse1",
                CustomFields = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                },
            };

            this.CompareXml(expected, record);
        }
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_apadjustment>
        <vendorid>VENDOR1</vendorid>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <apadjustmentitems>
            <lineitem>
                <glaccountno />
                <amount>76343.43</amount>
            </lineitem>
        </apadjustmentitems>
    </create_apadjustment>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

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

            ApAdjustmentLineCreate line1 = new ApAdjustmentLineCreate();

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

            ApAdjustmentLineCreate record = new ApAdjustmentLineCreate()
            {
                TransactionAmount = 76343.43M,
            };

            this.CompareXml(expected, record);
        }
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_apadjustment>
        <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>
        <batchkey>20323</batchkey>
        <adjustmentno>234</adjustmentno>
        <action>Submit</action>
        <billno>234235</billno>
        <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>
        <apadjustmentitems>
            <lineitem>
                <glaccountno />
                <amount>76343.43</amount>
            </lineitem>
        </apadjustmentitems>
    </create_apadjustment>
</function>";

            ApAdjustmentCreate record = new ApAdjustmentCreate("unittest")
            {
                VendorId            = "VENDOR1",
                TransactionDate     = new DateTime(2015, 06, 30),
                GlPostingDate       = new DateTime(2015, 06, 30),
                SummaryRecordNo     = 20323,
                AdjustmentNumber    = "234",
                Action              = "Submit",
                BillNumber          = "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" }
                },
            };

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

            record.Lines.Add(line1);

            this.CompareXml(expected, record);
        }
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_apadjustment>
        <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>
        <batchkey>20323</batchkey>
        <adjustmentno>234</adjustmentno>
        <action>Submit</action>
        <billno>234235</billno>
        <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>
        <apadjustmentitems>
            <lineitem>
                <glaccountno />
                <amount>76343.43</amount>
            </lineitem>
        </apadjustmentitems>
    </create_apadjustment>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ApAdjustmentCreate record = new ApAdjustmentCreate("unittest")
            {
                VendorId            = "VENDOR1",
                TransactionDate     = new DateTime(2015, 06, 30),
                GlPostingDate       = new DateTime(2015, 06, 30),
                SummaryRecordNo     = 20323,
                AdjustmentNumber    = "234",
                Action              = "Submit",
                BillNumber          = "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" }
                },
            };

            ApAdjustmentLineCreate line1 = new ApAdjustmentLineCreate();

            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());
        }
        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>Key1</key>
    <totalpaid>23484.93</totalpaid>
    <totaldue>0.0</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>
    <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);

            ApAdjustmentLineCreate record = new ApAdjustmentLineCreate()
            {
                AccountLabel          = "TestBill Account1",
                OffsetGlAccountNumber = "93590253",
                TransactionAmount     = 76343.43M,
                Memo         = "Just another memo",
                Key          = "Key1",
                TotalPaid    = 23484.93M,
                TotalDue     = 0.0M,
                LocationId   = "Location1",
                DepartmentId = "Department1",
                ProjectId    = "Project1",
                CustomerId   = "Customer1",
                VendorId     = "Vendor1",
                EmployeeId   = "Employee1",
                ItemId       = "Item1",
                ClassId      = "Class1",
                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());
        }