コード例 #1
0
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<expense>
    <glaccountno />
</expense>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ExpenseReportLineCreate record = new ExpenseReportLineCreate();

            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());
        }
コード例 #2
0
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_expensereport>
        <employeeid>E0001</employeeid>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <expenses>
            <expense>
                <glaccountno />
            </expense>
        </expenses>
    </create_expensereport>
</function>";

            ExpenseReportCreate record = new ExpenseReportCreate("unittest")
            {
                EmployeeId      = "E0001",
                TransactionDate = new DateTime(2015, 06, 30)
            };

            ExpenseReportLineCreate line1 = new ExpenseReportLineCreate();

            record.Lines.Add(line1);

            this.CompareXml(expected, record);
        }
コード例 #3
0
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<expense>
    <glaccountno />
</expense>";

            ExpenseReportLineCreate record = new ExpenseReportLineCreate();

            this.CompareXml(expected, record);
        }
コード例 #4
0
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_expensereport>
        <employeeid>E0001</employeeid>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <expenses>
            <expense>
                <glaccountno />
            </expense>
        </expenses>
    </create_expensereport>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ExpenseReportCreate record = new ExpenseReportCreate("unittest");

            record.EmployeeId      = "E0001";
            record.TransactionDate = new DateTime(2015, 06, 30);

            ExpenseReportLineCreate line1 = new ExpenseReportLineCreate();

            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());
        }
コード例 #5
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_expensereport>
        <employeeid>E0001</employeeid>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <dateposted>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </dateposted>
        <batchkey>123</batchkey>
        <expensereportno>ER001</expensereportno>
        <state>Submitted</state>
        <description>For hotel</description>
        <memo>Memo</memo>
        <externalid>122</externalid>
        <basecurr>USD</basecurr>
        <currency>USD</currency>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <supdocid>AT122</supdocid>
        <expenses>
            <expense>
                <glaccountno />
            </expense>
        </expenses>
    </create_expensereport>
</function>";

            ExpenseReportCreate record = new ExpenseReportCreate("unittest")
            {
                EmployeeId          = "E0001",
                TransactionDate     = new DateTime(2015, 06, 30),
                GlPostingDate       = new DateTime(2015, 06, 30),
                SummaryRecordNo     = 123,
                ExpenseReportNumber = "ER001",
                Action                = "Submitted",
                ReasonForExpense      = "For hotel",
                Memo                  = "Memo",
                ExternalId            = "122",
                BaseCurrency          = "USD",
                ReimbursementCurrency = "USD",
                AttachmentsId         = "AT122",
                CustomFields          = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                },
            };


            ExpenseReportLineCreate line1 = new ExpenseReportLineCreate();

            record.Lines.Add(line1);

            this.CompareXml(expected, record);
        }
コード例 #6
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<expense>
    <glaccountno>7000</glaccountno>
    <amount>1025.99</amount>
    <currency>USD</currency>
    <trx_amount>76343.43</trx_amount>
    <exchratedate>
        <year>2016</year>
        <month>06</month>
        <day>30</day>
    </exchratedate>
    <exchratetype>Intacct Daily Rate</exchratetype>
    <expensedate>
        <year>2016</year>
        <month>06</month>
        <day>30</day>
    </expensedate>
    <memo>Marriott</memo>
    <form1099>true</form1099>
    <paidfor>Hotel</paidfor>
    <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>
    <billable>true</billable>
    <exppmttype>AMEX</exppmttype>
    <quantity>10</quantity>
    <rate>12.34</rate>
</expense>";

            ExpenseReportLineCreate record = new ExpenseReportLineCreate()
            {
                GlAccountNumber     = "7000",
                ReimbursementAmount = 1025.99M,
                TransactionCurrency = "USD",
                TransactionAmount   = 76343.43M,
                ExchangeRateDate    = new DateTime(2016, 06, 30),
                ExchangeRateType    = "Intacct Daily Rate",
                ExpenseDate         = new DateTime(2016, 06, 30),
                PaidTo          = "Marriott",
                PaidFor         = "Hotel",
                Form1099        = true,
                Billable        = true,
                PaymentTypeName = "AMEX",
                Quantity        = 10,
                UnitRate        = 12.34M,
                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);
        }
コード例 #7
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_expensereport>
        <employeeid>E0001</employeeid>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <dateposted>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </dateposted>
        <batchkey>123</batchkey>
        <expensereportno>ER001</expensereportno>
        <state>Submitted</state>
        <description>For hotel</description>
        <memo>Memo</memo>
        <externalid>122</externalid>
        <basecurr>USD</basecurr>
        <currency>USD</currency>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <supdocid>AT122</supdocid>
        <expenses>
            <expense>
                <glaccountno />
            </expense>
        </expenses>
    </create_expensereport>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ExpenseReportCreate record = new ExpenseReportCreate("unittest")
            {
                EmployeeId          = "E0001",
                TransactionDate     = new DateTime(2015, 06, 30),
                GlPostingDate       = new DateTime(2015, 06, 30),
                SummaryRecordNo     = 123,
                ExpenseReportNumber = "ER001",
                Action                = "Submitted",
                ReasonForExpense      = "For hotel",
                Memo                  = "Memo",
                ExternalId            = "122",
                BaseCurrency          = "USD",
                ReimbursementCurrency = "USD",
                AttachmentsId         = "AT122",
                CustomFields          = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                },
            };


            ExpenseReportLineCreate line1 = new ExpenseReportLineCreate();

            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());
        }
コード例 #8
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<expense>
    <glaccountno>7000</glaccountno>
    <amount>1025.99</amount>
    <currency>USD</currency>
    <trx_amount>76343.43</trx_amount>
    <exchratedate>
        <year>2016</year>
        <month>06</month>
        <day>30</day>
    </exchratedate>
    <exchratetype>Intacct Daily Rate</exchratetype>
    <expensedate>
        <year>2016</year>
        <month>06</month>
        <day>30</day>
    </expensedate>
    <memo>Marriott</memo>
    <form1099>true</form1099>
    <paidfor>Hotel</paidfor>
    <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>
    <billable>true</billable>
    <exppmttype>AMEX</exppmttype>
    <quantity>10</quantity>
    <rate>12.34</rate>
</expense>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ExpenseReportLineCreate record = new ExpenseReportLineCreate()
            {
                GlAccountNumber     = "7000",
                ReimbursementAmount = 1025.99M,
                TransactionCurrency = "USD",
                TransactionAmount   = 76343.43M,
                ExchangeRateDate    = new DateTime(2016, 06, 30),
                ExchangeRateType    = "Intacct Daily Rate",
                ExpenseDate         = new DateTime(2016, 06, 30),
                PaidTo          = "Marriott",
                PaidFor         = "Hotel",
                Form1099        = true,
                Billable        = true,
                PaymentTypeName = "AMEX",
                Quantity        = 10,
                UnitRate        = 12.34M,
                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());
        }