Beispiel #1
0
        public void InitOrdersTest()
        {
            var model = new GridModel <Customer>(GridKey);

            model.Columns.For(c => c.Name, "Name")
            .SortColumn(c => c.Name, SortDirection.Ascending)
            .GroupColumn(c => c.Name, 5);

            model.Columns.For(c => c.Country, "Country")
            .SortColumn(c => c.Country, SortDirection.Descending, 4)
            .GroupColumn(c => c.Country, 4);

            model.Columns.For(c => c.City, "City").SortColumn(c => c.City, SortDirection.Ascending, 2);

            model.InitOrders();

            Assert.IsTrue(model.Columns.First(c => c.Key == "Name").Value.SortOrder == 0);

            Assert.IsTrue(model.Columns.First(c => c.Key == "City").Value.SortOrder == 1);

            Assert.IsTrue(model.Columns.First(c => c.Key == "Country").Value.SortOrder == 2);


            Assert.IsTrue(model.Columns.First(c => c.Key == "Name").Value.GroupOrder == 1);

            Assert.IsTrue(model.Columns.First(c => c.Key == "Country").Value.GroupOrder == 0);

            Assert.IsTrue(model.Columns.First(c => c.Key == "City").Value.GroupOrder == null);
        }