public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<updateccpayitem line_num=""3"" />";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ChargeCardTransactionLineUpdate record = new ChargeCardTransactionLineUpdate();

            record.LineNo = 3;

            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""?>
<updateccpayitem line_num=""3"">
    <accountlabel>TestBill Account1</accountlabel>
    <description>Just another memo</description>
    <paymentamount>76343.43</paymentamount>
    <departmentid>Department1</departmentid>
    <locationid>Location1</locationid>
    <customerid>Customer1</customerid>
    <vendorid>Vendor1</vendorid>
    <employeeid>Employee1</employeeid>
    <projectid>Project1</projectid>
    <itemid>Item1</itemid>
    <classid>Class1</classid>
    <contractid>Contract1</contractid>
    <warehouseid>Warehouse1</warehouseid>
    <customfields>
        <customfield>
            <customfieldname>customfield1</customfieldname>
            <customfieldvalue>customvalue1</customfieldvalue>
        </customfield>
    </customfields>
</updateccpayitem>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ChargeCardTransactionLineUpdate record = new ChargeCardTransactionLineUpdate();

            record.LineNo            = 3;
            record.TransactionAmount = 76343.43M;
            record.AccountLabel      = "TestBill Account1";
            record.Memo         = "Just another memo";
            record.LocationId   = "Location1";
            record.DepartmentId = "Department1";
            record.ProjectId    = "Project1";
            record.CustomerId   = "Customer1";
            record.VendorId     = "Vendor1";
            record.EmployeeId   = "Employee1";
            record.ItemId       = "Item1";
            record.ClassId      = "Class1";
            record.ContractId   = "Contract1";
            record.WarehouseId  = "Warehouse1";
            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());
        }