Exemple #1
0
        public void CreditAmountTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<GLENTRY>
    <ACCOUNTNO />
    <TR_TYPE>-1</TR_TYPE>
    <TRX_AMOUNT>100.01</TRX_AMOUNT>
</GLENTRY>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            StatisticalJournalEntryLineCreate record = new StatisticalJournalEntryLineCreate();

            record.Amount = -100.01M;

            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());
        }
Exemple #2
0
        public void CustomAllocationTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<GLENTRY>
    <ACCOUNTNO>9000</ACCOUNTNO>
    <TR_TYPE>1</TR_TYPE>
    <TRX_AMOUNT>1000.00</TRX_AMOUNT>
    <ALLOCATION>Custom</ALLOCATION>
    <SPLIT>
        <AMOUNT>600.00</AMOUNT>
    </SPLIT>
    <SPLIT>
        <AMOUNT>400.00</AMOUNT>
    </SPLIT>
</GLENTRY>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            StatisticalJournalEntryLineCreate record = new StatisticalJournalEntryLineCreate()
            {
                StatAccountNumber = "9000",
                Amount            = 1000.00M,
                AllocationId      = "Custom",
            };

            CustomAllocationSplit split1 = new CustomAllocationSplit()
            {
                Amount = 600.00M,
            };

            CustomAllocationSplit split2 = new CustomAllocationSplit()
            {
                Amount = 400.00M,
            };

            record.CustomAllocationSplits.Add(split1);
            record.CustomAllocationSplits.Add(split2);

            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());
        }
Exemple #3
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<GLENTRY>
    <DOCUMENT>212</DOCUMENT>
    <ACCOUNTNO>9000</ACCOUNTNO>
    <TR_TYPE>1</TR_TYPE>
    <TRX_AMOUNT>1456.54</TRX_AMOUNT>
    <LOCATION>100</LOCATION>
    <DEPARTMENT>ADM</DEPARTMENT>
    <PROJECTID>P100</PROJECTID>
    <CUSTOMERID>C100</CUSTOMERID>
    <VENDORID>V100</VENDORID>
    <EMPLOYEEID>E100</EMPLOYEEID>
    <ITEMID>I100</ITEMID>
    <CLASSID>C200</CLASSID>
    <CONTRACTID>C300</CONTRACTID>
    <WAREHOUSEID>W100</WAREHOUSEID>
    <DESCRIPTION>my memo</DESCRIPTION>
    <CUSTOM01>123</CUSTOM01>
</GLENTRY>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            StatisticalJournalEntryLineCreate record = new StatisticalJournalEntryLineCreate()
            {
                DocumentNumber    = "212",
                StatAccountNumber = "9000",
                Amount            = 1456.54M,
                Memo         = "my memo",
                LocationId   = "100",
                DepartmentId = "ADM",
                ProjectId    = "P100",
                CustomerId   = "C100",
                VendorId     = "V100",
                EmployeeId   = "E100",
                ItemId       = "I100",
                ClassId      = "C200",
                ContractId   = "C300",
                WarehouseId  = "W100",
                CustomFields = new Dictionary <string, dynamic>
                {
                    { "CUSTOM01", "123" }
                }
            };

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