Exemple #1
0
        public void ApplyTest()
        {
            DataTable table = CreateTable();

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

            // Create a new data projection (column) filter
            var filter = new Projection("Floors", "Finished");

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

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

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

            Assert.AreEqual("Floors", result.Columns[0].ColumnName);
            Assert.AreEqual("Finished", result.Columns[1].ColumnName);
        }
Exemple #2
0
        public void ApplyTest()
        {
            DataTable table = new DataTable("myData");

            table.Columns.Add("Double", typeof(double));
            table.Columns.Add("Integer", typeof(int));
            table.Columns.Add("Boolean", typeof(bool));

            table.Rows.Add(4.20, 42, true);
            table.Rows.Add(-3.14, -17, false);
            table.Rows.Add(21.00, 0, false);

            Projection target = new Projection("Integer", "Boolean");

            DataTable actual = target.Apply(table);


            Assert.AreEqual(2, actual.Columns.Count);
            Assert.AreEqual(3, actual.Rows.Count);

            Assert.AreEqual("Integer", actual.Columns[0].ColumnName);
            Assert.AreEqual("Boolean", actual.Columns[1].ColumnName);
        }