public void PageSelector_Throws_When_Given_Negative_Index()
        {
            //Arrange
            var selector = new PageSelector <int>(list, Constants.PAGE_RecordCount);

            //Assert
            Assert.Throws <IndexOutOfRangeException>(() => selector.GetPage(Constants.PAGE_NegativeIndex));
        }
        public void PageSelector_Returns_Correct_RecordCount_When_Given_Valid_Index(int pageSize)
        {
            //Arrange
            var selector = new PageSelector <int>(list, pageSize);

            //Act
            IPagedList <int> pagedList = selector.GetPage(Constants.PAGE_First);

            //Assert
            Assert.AreEqual(pageSize, pagedList.PageSize);
        }
        public void PageSelector_Returns_CorrectPage_When_Given_Valid_Index(int index)
        {
            //Arrange
            var selector = new PageSelector <int>(list, Constants.PAGE_RecordCount);

            //Act
            IPagedList <int> pagedList = selector.GetPage(index);

            //Assert
            Assert.AreEqual(index, pagedList.PageIndex);
        }
예제 #4
0
        public void PageSelector_Returns_Correct_RecordCount_When_Given_Valid_Index(int pageSize)
        {
            //Arrange
            var selector = new PageSelector<int>(list, pageSize);

            //Act
            IPagedList<int> pagedList = selector.GetPage(Constants.PAGE_First);

            //Assert
            Assert.AreEqual(pageSize, pagedList.PageSize);
        }
예제 #5
0
        public void PageSelector_Returns_CorrectPage_When_Given_Valid_Index(int index)
        {
            //Arrange
            var selector = new PageSelector<int>(list, Constants.PAGE_RecordCount);

            //Act
            IPagedList<int> pagedList = selector.GetPage(index);

            //Assert
            Assert.AreEqual(index, pagedList.PageIndex);
        }
        public void PageSelector_Returns_Correct_Values_When_Given_Valid_Index_And_PageSize(int index, int pageSize)
        {
            //Arrange
            var selector = new PageSelector <int>(list, pageSize);

            //Act
            IPagedList <int> pagedList = selector.GetPage(index);

            //Assert
            for (int i = 0; i < pageSize; i++)
            {
                Assert.AreEqual(index * pageSize + i, pagedList[i]);
            }
        }
예제 #7
0
        public void PageSelector_Returns_Correct_Values_When_Given_Valid_Index_And_PageSize(int index, int pageSize)
        {
            //Arrange
            var selector = new PageSelector<int>(list, pageSize);

            //Act
            IPagedList<int> pagedList = selector.GetPage(index);

            //Assert
            for (int i = 0; i < pageSize; i++)
            {
                Assert.AreEqual(index*pageSize + i, pagedList[i]);
            }
        }
예제 #8
0
        public void PageSelector_Throws_When_Given_Negative_Index()
        {
            //Arrange
            var selector = new PageSelector<int>(list, Constants.PAGE_RecordCount);

            //Assert
            Assert.Throws<IndexOutOfRangeException>(() => selector.GetPage(Constants.PAGE_NegativeIndex));
        }