CreateTable() public static method

public static CreateTable ( ) : DataTable
return System.Data.DataTable
Example #1
0
        public void ApplyTest1()
        {
            DataTable table = ProjectionFilterTest.CreateTable();

            // Show the start data
            //DataGridBox.Show(table);

            // Create a new data projection (column) filter
            var filter = new Codification(table, "Category");

            // Apply the filter and get the result
            DataTable result = filter.Apply(table);

            // Show it
            //DataGridBox.Show(result);

            Assert.AreEqual(5, result.Columns.Count);
            Assert.AreEqual(5, result.Rows.Count);

            Assert.AreEqual(0, result.Rows[0]["Category"]);
            Assert.AreEqual(1, result.Rows[1]["Category"]);
            Assert.AreEqual(1, result.Rows[2]["Category"]);
            Assert.AreEqual(0, result.Rows[3]["Category"]);
            Assert.AreEqual(2, result.Rows[4]["Category"]);
        }
        public void ApplyTest1()
        {
            DataTable table = ProjectionFilterTest.CreateTable();

            // Show the start data
            // DataGridBox.Show(table);

            // Create a new data projection (column) filter
            var filter = new Discretization("Cost (M)");

            // Apply the filter and get the result
            DataTable result = filter.Apply(table);

            // Show it
            // DataGridBox.Show(result);

            Assert.AreEqual(5, result.Columns.Count);
            Assert.AreEqual(5, result.Rows.Count);

            Assert.AreEqual("213", result.Rows[0]["Cost (M)"]);
            Assert.AreEqual("4", result.Rows[1]["Cost (M)"]);
            Assert.AreEqual("3", result.Rows[2]["Cost (M)"]);
            Assert.AreEqual("3", result.Rows[3]["Cost (M)"]);
            Assert.AreEqual("2", result.Rows[4]["Cost (M)"]);
        }