コード例 #1
0
        public void TestPaginationHelper()
        {
            var myHelper = new KataPaginationHelper <char>(new List <char> {
                'a', 'b', 'c', 'd', 'e', 'f'
            }, 4);

            Assert.AreEqual(2, myHelper.PageCount);
            Assert.AreEqual(6, myHelper.ItemCount);
            Assert.AreEqual(4, myHelper.PageItemCount(0));
            Assert.AreEqual(2, myHelper.PageItemCount(1));
            Assert.AreEqual(-1, myHelper.PageItemCount(2));

            // pageIndex takes an item index and returns the page that it belongs on
            Assert.AreEqual(1, myHelper.PageIndex(5));
            Assert.AreEqual(0, myHelper.PageIndex(2));
            Assert.AreEqual(-1, myHelper.PageIndex(20));
            Assert.AreEqual(-1, myHelper.PageIndex(-1));
        }
コード例 #2
0
 public void Init()
 {
     helper = new KataPaginationHelper <int>(collection, 10);
 }