Example #1
0
        public void BuildValueClusters_NoValues()
        {
            var test = new ValueClusterCollection(200);

            using (var dataTable = new DataTable {
                TableName = "ArtificialTable", Locale = new CultureInfo("en-gb")
            })
            {
                dataTable.Columns.Add("ID", typeof(long));
                dataTable.Columns.Add("Text", typeof(string));
                dataTable.Columns.Add("STart", typeof(DateTime));
                for (long i = 1; i < 20; i++)
                {
                    var row = dataTable.NewRow();
                    dataTable.Rows.Add(row);
                }

                using (var dataView = new DataView(dataTable, null, null, DataViewRowState.CurrentRows))
                {
                    Assert.AreEqual(BuildValueClustersResult.NoValues, test.BuildValueClusters(dataView, typeof(long), 0));
                    Assert.AreEqual(BuildValueClustersResult.NoValues, test.BuildValueClusters(dataView, typeof(string), 1));
                    Assert.AreEqual(BuildValueClustersResult.NoValues, test.BuildValueClusters(dataView, typeof(DateTime), 2));
                }
            }
        }
Example #2
0
        public void BuildValueClusters_StringListFilled()
        {
            var test = new ValueClusterCollection(-1);

            Assert.AreEqual(BuildValueClustersResult.ListFilled, test.BuildValueClusters(m_DataView, typeof(string), 0));
            Assert.AreEqual(BuildValueClustersResult.ListFilled, test.BuildValueClusters(m_DataView, typeof(string), 7));
            Assert.IsNotNull(test.ValueClusters);
        }
Example #3
0
        public void BuildValueClusters_StringTooManyValues()
        {
            var test = new ValueClusterCollection(20);

            Assert.AreEqual(BuildValueClustersResult.TooManyValues, test.BuildValueClusters(m_DataView, typeof(string), 0));
            Assert.AreEqual(0, test.ValueClusters.Count());
        }
Example #4
0
        public void BuildValueClusters_LongRangeStep10()
        {
            var test = new ValueClusterCollection(200);

            using (var dataTable = new DataTable {
                TableName = "ArtificialTable", Locale = new CultureInfo("en-gb")
            })
            {
                dataTable.Columns.Add("ID", typeof(long));
                for (long i = -199; i < 200; i++)
                {
                    var row = dataTable.NewRow();
                    row[0] = i; // random.Next(-20, 20);
                    dataTable.Rows.Add(row);
                }

                using (var dataView = new DataView(dataTable, null, null, DataViewRowState.CurrentRows))
                {
                    test.BuildValueClusters(dataView, typeof(long), 0);
                    Assert.AreEqual(40, test.ValueClusters.Count);
                    TestSort(test.ValueClusters);
                    Assert.IsTrue(test.ValueClusters.First().Display.Contains("-200") && test.ValueClusters.First().Display.Contains("-190"),
                                  test.ValueClusters.First().Display);
                    Assert.IsTrue(test.ValueClusters.Last().Display.Contains("190") && test.ValueClusters.Last().Display.Contains("200"),
                                  test.ValueClusters.Last().Display);
                }
            }
        }
Example #5
0
        public void BuildValueClusters_double()
        {
            var test = new ValueClusterCollection(200);
            var res  = test.BuildValueClusters(m_DataView, typeof(double), 4);

            Assert.AreEqual(BuildValueClustersResult.ListFilled, res);
            TestSort(test.ValueClusters);
        }
Example #6
0
        public void GetActiveValueClusterTest()
        {
            var test = new ValueClusterCollection(200);

            Assert.AreEqual(BuildValueClustersResult.ListFilled, test.BuildValueClusters(m_DataView, typeof(string), 0));
            Assert.AreEqual(0, test.GetActiveValueCluster().Count());
            foreach (var item in test.ValueClusters)
            {
                item.Active = true;
            }
            Assert.AreEqual(test.ValueClusters.Count(), test.GetActiveValueCluster().Count());
        }
        public void GetActiveValueClusterTest()
        {
            var data     = UnitTestStatic.GetDataTable(200);
            var dataview = new DataView(data, null, null, DataViewRowState.CurrentRows);

            var test0a = new ValueClusterCollection();

            Assert.AreEqual(BuildValueClustersResult.ListFilled, test0a.BuildValueClusters(dataview, typeof(string), 0, 200));
            Assert.AreEqual(0, test0a.GetActiveValueCluster().Count());
            foreach (var iten in test0a.ValueClusters)
            {
                iten.Active = true;
            }
            Assert.AreEqual(test0a.ValueClusters.Count(), test0a.GetActiveValueCluster().Count());
        }
        public void BuildValueClustersTest()
        {
            var data     = UnitTestStatic.GetDataTable(200);
            var dataview = new DataView(data, null, null, DataViewRowState.CurrentRows);

            var test0a = new ValueClusterCollection();

            Assert.AreEqual(BuildValueClustersResult.ListFilled, test0a.BuildValueClusters(dataview, typeof(string), 0, 200));
            Assert.IsNotNull(test0a.ValueClusters);

            var test0b = new ValueClusterCollection();

            Assert.AreEqual(BuildValueClustersResult.TooManyValues, test0b.BuildValueClusters(dataview, typeof(string), 0, 1));
            Assert.AreEqual(0, test0b.ValueClusters.Count());

            var test1 = new ValueClusterCollection();

            Assert.AreEqual(BuildValueClustersResult.ListFilled, test1.BuildValueClusters(dataview, typeof(int), 1, 200));

            var test2 = new ValueClusterCollection();

            Assert.AreEqual(BuildValueClustersResult.ListFilled, test2.BuildValueClusters(dataview, typeof(DateTime), 2, 200));

            var test3 = new ValueClusterCollection();

            Assert.AreEqual(BuildValueClustersResult.ListFilled, test3.BuildValueClusters(dataview, typeof(bool), 3, 2));

            var test4 = new ValueClusterCollection();

            Assert.AreEqual(BuildValueClustersResult.ListFilled, test4.BuildValueClusters(dataview, typeof(double), 4, 200));

            var test5 = new ValueClusterCollection();

            Assert.AreEqual(BuildValueClustersResult.ListFilled, test5.BuildValueClusters(dataview, typeof(decimal), 5, 200));

            var test7 = new ValueClusterCollection();

            Assert.AreEqual(BuildValueClustersResult.ListFilled, test7.BuildValueClusters(dataview, typeof(string), 7, 200));
        }
Example #9
0
        public void BuildValueClusters_int()
        {
            var test = new ValueClusterCollection(200);

            Assert.AreEqual(BuildValueClustersResult.ListFilled, test.BuildValueClusters(m_DataView, typeof(int), 1));
        }