示例#1
0
        public void when_configures_page_size_equal_to_zero_throws_ArgumentException()
        {
            var grid       = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType <DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 50, 0);
        }
示例#2
0
        public void datasource_count_should_match_page_size()
        {
            var grid       = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType <DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 50, 10);
            Assert.AreEqual(10, ((IEnumerable <DataRow>)grid.DataSource).Count());
        }
示例#3
0
        public void datasource_count_should_match_page_size()
        {
            var grid = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType<DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 50, 10);
            Assert.AreEqual(10, ((IEnumerable<DataRow>)grid.DataSource).Count());
        }
示例#4
0
        public void verify_total_page_count()
        {
            var grid       = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType <DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 50, 10);

            Assert.AreEqual(5, grid.TotalPages());
        }
示例#5
0
        public void when_loads_the_grid_should_go_to_the_first_page()
        {
            var grid       = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType <DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 50, 10);

            Assert.AreEqual(0, grid.CurrentPage);
            Assert.AreEqual("foo0", ((IEnumerable <DataRow>)grid.DataSource).ToList()[0][1]);
        }
示例#6
0
        public void datasource_count_should_be_less_than_page_size_for_incomplete_pages()
        {
            var grid       = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType <DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 55, 10);
            grid.OnGotoLast();

            Assert.IsTrue(((IEnumerable <DataRow>)grid.DataSource).Count() < 10);
        }
示例#7
0
        public void datasource_count_should_be_less_than_page_size_for_incomplete_pages()
        {
            var grid = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType<DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 55, 10);
            grid.OnGotoLast();

            Assert.IsTrue(((IEnumerable<DataRow>)grid.DataSource).Count() < 10);
        }
示例#8
0
        public void goto_next_page()
        {
            var grid       = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType <DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 50, 10);

            grid.OnGotoNext();
            Assert.AreEqual(1, grid.CurrentPage);
            Assert.AreEqual("foo10", ((IEnumerable <DataRow>)grid.DataSource).ToList()[0][1]);
        }
示例#9
0
        public void goto_last_page()
        {
            var grid = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType<DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 50, 10);
            grid.OnGotoLast();

            Assert.AreEqual(4, grid.CurrentPage);
            Assert.AreEqual("foo40", ((IEnumerable<DataRow>)grid.DataSource).ToList()[0][1]);
        }
示例#10
0
        public void goto_last_incomplete_page()
        {
            for (var i = 0; i < 5; i++)
                _rawData.Rows.Add(new object[] { i, "foo5" + i });
            var grid = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType<DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 55, 10);
            grid.OnGotoLast();

            Assert.AreEqual(5, grid.CurrentPage);
            Assert.AreEqual(5, ((IEnumerable<DataRow>)grid.DataSource).Count());
            Assert.AreEqual("foo50", ((IEnumerable<DataRow>)grid.DataSource).ToList()[0][1]);
        }
示例#11
0
        public void goto_last_incomplete_page()
        {
            for (var i = 0; i < 5; i++)
            {
                _rawData.Rows.Add(new object[] { i, "foo5" + i });
            }
            var grid       = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType <DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 55, 10);
            grid.OnGotoLast();

            Assert.AreEqual(5, grid.CurrentPage);
            Assert.AreEqual(5, ((IEnumerable <DataRow>)grid.DataSource).Count());
            Assert.AreEqual("foo50", ((IEnumerable <DataRow>)grid.DataSource).ToList()[0][1]);
        }
示例#12
0
        public void when_loads_the_grid_should_go_to_the_first_page()
        {
            var grid = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType<DataRow>().AsQueryable() select row;

            grid.Configure(dataSource,() => 50, 10);

            Assert.AreEqual(0, grid.CurrentPage);
            Assert.AreEqual("foo0", ((IEnumerable<DataRow>)grid.DataSource).ToList()[0][1]);
        }
示例#13
0
        public void when_configures_page_size_equal_to_zero_throws_ArgumentException()
        {
            var grid = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType<DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 50, 0);
        }
示例#14
0
        public void verify_total_page_count_when_last_page_is_incomplete()
        {
            var grid = new PowerGridControl();
            var dataSource = from DataRow row in _rawData.Rows.OfType<DataRow>().AsQueryable() select row;

            grid.Configure(dataSource, () => 55, 10);

            Assert.AreEqual(6, grid.TotalPages());
        }