Esempio n. 1
0
        public void GetXmlTest()
        {
            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>
        <ccpayitems>
            <ccpayitem>
                <glaccountno />
                <paymentamount>76343.43</paymentamount>
            </ccpayitem>
        </ccpayitems>
    </record_cctransaction>
</function>";

            ChargeCardTransactionCreate record = new ChargeCardTransactionCreate("unittest")
            {
                ChargeCardId    = "AMEX1234",
                TransactionDate = new DateTime(2015, 06, 30)
            };

            ChargeCardTransactionLineCreate line = new ChargeCardTransactionLineCreate
            {
                TransactionAmount = 76343.43M
            };

            record.Lines.Add(line);

            this.CompareXml(expected, record);
        }
Esempio n. 2
0
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<ccpayitem>
    <glaccountno />
    <paymentamount>76343.43</paymentamount>
</ccpayitem>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ChargeCardTransactionLineCreate record = new ChargeCardTransactionLineCreate();

            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());
        }
        public void GetXmlTest()
        {
            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>
        <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);

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

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

            this.CompareXml(expected, record);
        }
Esempio n. 5
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<ccpayitem>
    <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>
</ccpayitem>";

            ChargeCardTransactionLineCreate record = new ChargeCardTransactionLineCreate
            {
                TransactionAmount = 76343.43M,
                AccountLabel      = "TestBill Account1",
                Memo         = "Just another memo",
                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);
        }
Esempio n. 6
0
        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>";

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

            ChargeCardTransactionLineCreate line = new ChargeCardTransactionLineCreate
            {
                TransactionAmount = 76343.43M
            };

            record.Lines.Add(line);

            this.CompareXml(expected, record);
        }
Esempio n. 7
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<ccpayitem>
    <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>
</ccpayitem>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ChargeCardTransactionLineCreate record = new ChargeCardTransactionLineCreate();

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