Exemple #1
0
        public void FrameViewOrderByColumn()
        {
            FrameView original = GetTestFrame();

            string columnName = "bmi";

            FrameView reordered = original.OrderBy(columnName, SortOrder.Descending);

            Assert.IsTrue(reordered.Columns.Count == original.Columns.Count);
            Assert.IsTrue(reordered.Rows.Count == original.Rows.Count);

            int columnIndex = reordered.GetColumnIndex(columnName);

            for (int i = 1; i < reordered.Rows.Count; i++)
            {
                IComparable previous = (IComparable)reordered[i - 1, columnIndex];
                IComparable current  = (IComparable)reordered[i, columnIndex];
                Assert.IsTrue(previous.CompareTo(current) >= 0);
            }
        }