コード例 #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);

            OtherReceiptLineCreate line = new OtherReceiptLineCreate();

            line.TransactionAmount = 76343.43M;

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

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

            this.CompareXml(expected, record);
        }
コード例 #3
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>";

            OtherReceiptLineCreate record = new OtherReceiptLineCreate
            {
                AccountLabel      = "TestBill Account1",
                TransactionAmount = 76343.43M,
                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);
        }
コード例 #4
0
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <record_otherreceipt>
        <paymentdate>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </paymentdate>
        <payee>Costco</payee>
        <receiveddate>
            <year>2015</year>
            <month>07</month>
            <day>01</day>
        </receiveddate>
        <paymentmethod>Printed Check</paymentmethod>
        <undepglaccountno>1000</undepglaccountno>
        <receiptitems>
            <lineitem>
                <glaccountno />
                <amount>76343.43</amount>
            </lineitem>
        </receiptitems>
    </record_otherreceipt>
</function>";

            OtherReceiptCreate record =
                new OtherReceiptCreate("unittest")
            {
                TransactionDate             = new DateTime(2015, 06, 30),
                Payer                       = "Costco",
                ReceiptDate                 = new DateTime(2015, 07, 01),
                PaymentMethod               = "Printed Check",
                UndepositedFundsGlAccountNo = "1000"
            };

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

            record.Lines.Add(line);

            this.CompareXml(expected, record);
        }
コード例 #5
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <record_otherreceipt>
        <paymentdate>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </paymentdate>
        <payee>Costco</payee>
        <receiveddate>
            <year>2015</year>
            <month>07</month>
            <day>01</day>
        </receiveddate>
        <paymentmethod>Printed Check</paymentmethod>
        <bankaccountid>BA1234</bankaccountid>
        <depositdate>
            <year>2015</year>
            <month>07</month>
            <day>04</day>
        </depositdate>
        <refid>transno</refid>
        <description>my desc</description>
        <supdocid>A1234</supdocid>
        <currency>USD</currency>
        <exchratedate>
            <year>2015</year>
            <month>07</month>
            <day>04</day>
        </exchratedate>
        <exchratetype>Intacct Daily Rate</exchratetype>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <receiptitems>
            <lineitem>
                <glaccountno />
                <amount>76343.43</amount>
            </lineitem>
        </receiptitems>
    </record_otherreceipt>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);


            OtherReceiptCreate record = new OtherReceiptCreate("unittest");

            record.TransactionDate             = new DateTime(2015, 06, 30);
            record.Payer                       = "Costco";
            record.ReceiptDate                 = new DateTime(2015, 07, 01);
            record.PaymentMethod               = "Printed Check";
            record.BankAccountId               = "BA1234";
            record.DepositDate                 = new DateTime(2015, 07, 04);
            record.UndepositedFundsGlAccountNo = "1000";
            record.TransactionNo               = "transno";
            record.Description                 = "my desc";
            record.AttachmentsId               = "A1234";
            record.TransactionCurrency         = "USD";
            record.ExchangeRateDate            = new DateTime(2015, 07, 04);
            record.ExchangeRateType            = "Intacct Daily Rate";

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

            OtherReceiptLineCreate Line = new OtherReceiptLineCreate();

            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());
        }
コード例 #6
0
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <record_otherreceipt>
        <paymentdate>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </paymentdate>
        <payee>Costco</payee>
        <receiveddate>
            <year>2015</year>
            <month>07</month>
            <day>01</day>
        </receiveddate>
        <paymentmethod>Printed Check</paymentmethod>
        <undepglaccountno>1000</undepglaccountno>
        <receiptitems>
            <lineitem>
                <glaccountno />
                <amount>76343.43</amount>
            </lineitem>
        </receiptitems>
    </record_otherreceipt>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            OtherReceiptCreate record = new OtherReceiptCreate("unittest");

            record.TransactionDate             = new DateTime(2015, 06, 30);
            record.Payer                       = "Costco";
            record.ReceiptDate                 = new DateTime(2015, 07, 01);
            record.PaymentMethod               = "Printed Check";
            record.UndepositedFundsGlAccountNo = "1000";

            OtherReceiptLineCreate Line = new OtherReceiptLineCreate();

            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());
        }
コード例 #7
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <record_otherreceipt>
        <paymentdate>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </paymentdate>
        <payee>Costco</payee>
        <receiveddate>
            <year>2015</year>
            <month>07</month>
            <day>01</day>
        </receiveddate>
        <paymentmethod>Printed Check</paymentmethod>
        <bankaccountid>BA1234</bankaccountid>
        <depositdate>
            <year>2015</year>
            <month>07</month>
            <day>04</day>
        </depositdate>
        <refid>transno</refid>
        <description>my desc</description>
        <supdocid>A1234</supdocid>
        <currency>USD</currency>
        <exchratedate>
            <year>2015</year>
            <month>07</month>
            <day>04</day>
        </exchratedate>
        <exchratetype>Intacct Daily Rate</exchratetype>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <receiptitems>
            <lineitem>
                <glaccountno />
                <amount>76343.43</amount>
            </lineitem>
        </receiptitems>
    </record_otherreceipt>
</function>";

            OtherReceiptCreate record = new OtherReceiptCreate("unittest")
            {
                TransactionDate             = new DateTime(2015, 06, 30),
                Payer                       = "Costco",
                ReceiptDate                 = new DateTime(2015, 07, 01),
                PaymentMethod               = "Printed Check",
                BankAccountId               = "BA1234",
                DepositDate                 = new DateTime(2015, 07, 04),
                UndepositedFundsGlAccountNo = "1000",
                TransactionNo               = "transno",
                Description                 = "my desc",
                AttachmentsId               = "A1234",
                TransactionCurrency         = "USD",
                ExchangeRateDate            = new DateTime(2015, 07, 04),
                ExchangeRateType            = "Intacct Daily Rate",
                CustomFields                = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

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

            record.Lines.Add(line);

            this.CompareXml(expected, record);
        }
コード例 #8
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());
        }