예제 #1
0
        public void Process_SortsEnabledColumns()
        {
            IQueryable <GridModel> items = new[]
            {
                new GridModel {
                    Name = "a", Text = "a", Sum = 20
                },
                new GridModel {
                    Name = "b", Text = "b", Sum = 10
                },
                new GridModel {
                    Name = "a", Text = "c", Sum = 10
                }
            }.AsQueryable();

            sumColumn.Sort.IsEnabled  = true;
            nameColumn.Sort.IsEnabled = true;
            textColumn.Sort.IsEnabled = false;
            sort.Grid.Query           = HttpUtility.ParseQueryString("sort=text asc,name asc,sum asc");

            IQueryable <GridModel> expected = items.OrderBy(item => item.Name).ThenBy(item => item.Sum);
            IQueryable <GridModel> actual   = sort.Process(items);

            Assert.Equal(expected, actual);
        }