public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <apply_arpayment>
        <arpaymentkey>1234</arpaymentkey>
        <paymentdate>
            <year>2016</year>
            <month>06</month>
            <day>30</day>
        </paymentdate>
    </apply_arpayment>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            ArPaymentApply record = new ArPaymentApply("unittest");

            record.RecordNo     = 1234;
            record.ReceivedDate = new DateTime(2016, 06, 30);

            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());
        }
Beispiel #2
0
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <apply_arpayment>
        <arpaymentkey>1234</arpaymentkey>
        <paymentdate>
            <year>2016</year>
            <month>06</month>
            <day>30</day>
        </paymentdate>
    </apply_arpayment>
</function>";

            ArPaymentApply record = new ArPaymentApply("unittest")
            {
                RecordNo     = 1234,
                ReceivedDate = new DateTime(2016, 06, 30)
            };

            this.CompareXml(expected, record);
        }