Exemplo n.º 1
0
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_ictransaction>
        <transactiontype>Purchase Order</transactiontype>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <ictransitems>
            <ictransitem>
                <itemid>02354032</itemid>
                <warehouseid>W1234</warehouseid>
                <quantity>1200</quantity>
            </ictransitem>
        </ictransitems>
    </create_ictransaction>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            InventoryTransactionCreate record = new InventoryTransactionCreate("unittest")
            {
                TransactionDefinition = "Purchase Order",
                TransactionDate       = new DateTime(2015, 06, 30),
            };

            InventoryTransactionLineCreate line1 = new InventoryTransactionLineCreate()
            {
                ItemId      = "02354032",
                WarehouseId = "W1234",
                Quantity    = 1200,
            };

            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());
        }
Exemplo n.º 2
0
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<ictransitem>
    <itemid>26323</itemid>
    <warehouseid>W1234</warehouseid>
    <quantity>2340</quantity>
</ictransitem>";

            InventoryTransactionLineCreate record = new InventoryTransactionLineCreate()
            {
                ItemId      = "26323",
                WarehouseId = "W1234",
                Quantity    = 2340,
            };

            this.CompareXml(expected, record);
        }
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_ictransaction>
        <transactiontype>Purchase Order</transactiontype>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <ictransitems>
            <ictransitem>
                <itemid>02354032</itemid>
                <warehouseid>W1234</warehouseid>
                <quantity>1200</quantity>
            </ictransitem>
        </ictransitems>
    </create_ictransaction>
</function>";

            InventoryTransactionCreate record = new InventoryTransactionCreate("unittest")
            {
                TransactionDefinition = "Purchase Order",
                TransactionDate       = new DateTime(2015, 06, 30),
            };

            InventoryTransactionLineCreate line1 = new InventoryTransactionLineCreate()
            {
                ItemId      = "02354032",
                WarehouseId = "W1234",
                Quantity    = 1200,
            };

            record.Lines.Add(line1);

            this.CompareXml(expected, record);
        }
        public void GetXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<ictransitem>
    <itemid>26323</itemid>
    <warehouseid>W1234</warehouseid>
    <quantity>2340</quantity>
</ictransitem>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            InventoryTransactionLineCreate record = new InventoryTransactionLineCreate()
            {
                ItemId      = "26323",
                WarehouseId = "W1234",
                Quantity    = 2340,
            };

            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());
        }
Exemplo n.º 5
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_ictransaction>
        <transactiontype>Inventory Shipper</transactiontype>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <createdfrom>Inventory Shipper-P1002</createdfrom>
        <documentno>23430</documentno>
        <referenceno>234235</referenceno>
        <message>Submit</message>
        <externalid>20394</externalid>
        <basecurr>USD</basecurr>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <state>Pending</state>
        <ictransitems>
            <ictransitem>
                <itemid>2390552</itemid>
                <warehouseid>W1234</warehouseid>
                <quantity>223</quantity>
            </ictransitem>
        </ictransitems>
        <subtotals>
            <subtotal>
                <description>Subtotal description</description>
                <total>223</total>
            </subtotal>
        </subtotals>
    </create_ictransaction>
</function>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            InventoryTransactionCreate record = new InventoryTransactionCreate("unittest")
            {
                TransactionDefinition = "Inventory Shipper",
                TransactionDate       = new DateTime(2015, 06, 30),
                CreatedFrom           = "Inventory Shipper-P1002",
                DocumentNumber        = "23430",
                ReferenceNumber       = "234235",
                Message      = "Submit",
                ExternalId   = "20394",
                BaseCurrency = "USD",
                State        = "Pending",
                CustomFields = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

            InventoryTransactionLineCreate line1 = new InventoryTransactionLineCreate()
            {
                ItemId      = "2390552",
                WarehouseId = "W1234",
                Quantity    = 223,
            };

            record.Lines.Add(line1);

            TransactionSubtotalCreate subtotal1 = new TransactionSubtotalCreate()
            {
                Description = "Subtotal description",
                Total       = 223,
            };

            record.Subtotals.Add(subtotal1);

            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());
        }
Exemplo n.º 6
0
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<ictransitem>
    <itemid>26323</itemid>
    <itemdesc>Item Description</itemdesc>
    <warehouseid>93294</warehouseid>
    <quantity>2340</quantity>
    <unit>593</unit>
    <cost>32.35</cost>
    <locationid>SF</locationid>
    <departmentid>Purchasing</departmentid>
    <itemdetails>
        <itemdetail>
            <quantity>52</quantity>
            <lotno>3243</lotno>
        </itemdetail>
    </itemdetails>
    <customfields>
        <customfield>
            <customfieldname>customfield1</customfieldname>
            <customfieldvalue>customvalue1</customfieldvalue>
        </customfield>
    </customfields>
    <projectid>235</projectid>
    <customerid>23423434</customerid>
    <vendorid>797656</vendorid>
    <employeeid>90295</employeeid>
    <classid>243609</classid>
    <contractid>9062</contractid>
</ictransitem>";

            InventoryTransactionLineCreate record = new InventoryTransactionLineCreate()
            {
                ItemId          = "26323",
                ItemDescription = "Item Description",
                WarehouseId     = "93294",
                Quantity        = 2340,
                Unit            = "593",
                Cost            = 32.35M,
                LocationId      = "SF",
                DepartmentId    = "Purchasing",
                ProjectId       = "235",
                CustomerId      = "23423434",
                VendorId        = "797656",
                EmployeeId      = "90295",
                ClassId         = "243609",
                ContractId      = "9062",
                CustomFields    = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

            TransactionItemDetail detail1 = new TransactionItemDetail()
            {
                Quantity  = 52,
                LotNumber = "3243",
            };

            record.ItemDetails.Add(detail1);

            this.CompareXml(expected, record);
        }
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
    <create_ictransaction>
        <transactiontype>Inventory Shipper</transactiontype>
        <datecreated>
            <year>2015</year>
            <month>06</month>
            <day>30</day>
        </datecreated>
        <createdfrom>Inventory Shipper-P1002</createdfrom>
        <documentno>23430</documentno>
        <referenceno>234235</referenceno>
        <message>Submit</message>
        <externalid>20394</externalid>
        <basecurr>USD</basecurr>
        <customfields>
            <customfield>
                <customfieldname>customfield1</customfieldname>
                <customfieldvalue>customvalue1</customfieldvalue>
            </customfield>
        </customfields>
        <state>Pending</state>
        <ictransitems>
            <ictransitem>
                <itemid>2390552</itemid>
                <warehouseid>W1234</warehouseid>
                <quantity>223</quantity>
            </ictransitem>
        </ictransitems>
        <subtotals>
            <subtotal>
                <description>Subtotal description</description>
                <total>223</total>
            </subtotal>
        </subtotals>
    </create_ictransaction>
</function>";

            InventoryTransactionCreate record = new InventoryTransactionCreate("unittest")
            {
                TransactionDefinition = "Inventory Shipper",
                TransactionDate       = new DateTime(2015, 06, 30),
                CreatedFrom           = "Inventory Shipper-P1002",
                DocumentNumber        = "23430",
                ReferenceNumber       = "234235",
                Message      = "Submit",
                ExternalId   = "20394",
                BaseCurrency = "USD",
                State        = "Pending",
                CustomFields = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

            InventoryTransactionLineCreate line1 = new InventoryTransactionLineCreate()
            {
                ItemId      = "2390552",
                WarehouseId = "W1234",
                Quantity    = 223,
            };

            record.Lines.Add(line1);

            TransactionSubtotalCreate subtotal1 = new TransactionSubtotalCreate()
            {
                Description = "Subtotal description",
                Total       = 223,
            };

            record.Subtotals.Add(subtotal1);

            this.CompareXml(expected, record);
        }
        public void GetAllXmlTest()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<ictransitem>
    <itemid>26323</itemid>
    <itemdesc>Item Description</itemdesc>
    <warehouseid>93294</warehouseid>
    <quantity>2340</quantity>
    <unit>593</unit>
    <cost>32.35</cost>
    <locationid>SF</locationid>
    <departmentid>Purchasing</departmentid>
    <itemdetails>
        <itemdetail>
            <quantity>52</quantity>
            <lotno>3243</lotno>
        </itemdetail>
    </itemdetails>
    <customfields>
        <customfield>
            <customfieldname>customfield1</customfieldname>
            <customfieldvalue>customvalue1</customfieldvalue>
        </customfield>
    </customfields>
    <projectid>235</projectid>
    <customerid>23423434</customerid>
    <vendorid>797656</vendorid>
    <employeeid>90295</employeeid>
    <classid>243609</classid>
    <contractid>9062</contractid>
</ictransitem>";

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

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

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            InventoryTransactionLineCreate record = new InventoryTransactionLineCreate()
            {
                ItemId          = "26323",
                ItemDescription = "Item Description",
                WarehouseId     = "93294",
                Quantity        = 2340,
                Unit            = "593",
                Cost            = 32.35M,
                LocationId      = "SF",
                DepartmentId    = "Purchasing",
                ProjectId       = "235",
                CustomerId      = "23423434",
                VendorId        = "797656",
                EmployeeId      = "90295",
                ClassId         = "243609",
                ContractId      = "9062",
                CustomFields    = new Dictionary <string, dynamic>
                {
                    { "customfield1", "customvalue1" }
                }
            };

            TransactionItemDetail detail1 = new TransactionItemDetail()
            {
                Quantity  = 52,
                LotNumber = "3243",
            };

            record.ItemDetails.Add(detail1);

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