Example #1
0
            public void HasValidNextPageAndEmptyPreviousPage()
            {
                PageNumberAndSizeTests.AssertIsEmpty(this.defaultPagingInfo.PreviousPage);

                Assert.AreEqual(PageNumberAndSize.DefaultPageSize, this.defaultPagingInfo.CurrentPage.Size);
                Assert.AreEqual(this.defaultPagingInfo.CurrentPage.Size, this.defaultPagingInfo.NextPage.Size);
            }
Example #2
0
        internal static void AssertIsLastPage(PagingInfo lastPageInfo)
        {
            Assert.AreEqual(
                lastPageInfo.LastPage.Number,
                lastPageInfo.CurrentPage.Number);

            Assert.IsTrue(lastPageInfo.HasValue);
            Assert.IsFalse(lastPageInfo.NextPage.HasValue);
            Assert.IsTrue(lastPageInfo.IsLastPage);

            PageNumberAndSizeTests.AssertEquality(
                lastPageInfo.LastPage, lastPageInfo.CurrentPage);
        }
Example #3
0
            public void HasEmptyPages()
            {
                PageNumberAndSizeTests.AssertIsEmpty(this.emptyPagingInfo.CurrentPage);
                PageNumberAndSizeTests.AssertIsEmpty(this.emptyPagingInfo.FirstPage);
                PageNumberAndSizeTests.AssertIsEmpty(this.emptyPagingInfo.LastPage);
                PageNumberAndSizeTests.AssertIsEmpty(this.emptyPagingInfo.NextPage);
                PageNumberAndSizeTests.AssertIsEmpty(this.emptyPagingInfo.PreviousPage);

                Assert.AreEqual(0, this.emptyPagingInfo.ItemCount);
                Assert.IsNull(this.emptyPagingInfo.AllPages);
                Assert.IsFalse(this.emptyPagingInfo.IsFirstPage);
                Assert.IsFalse(this.emptyPagingInfo.IsLastPage);
            }
Example #4
0
            public void HasValidFirstAndLastPages()
            {
                PageNumberAndSizeTests.AssertIsUnbounded(this.unboundedPagingInfo.CurrentPage);
                PageNumberAndSizeTests.AssertIsUnbounded(this.unboundedPagingInfo.FirstPage);
                PageNumberAndSizeTests.AssertIsUnbounded(this.unboundedPagingInfo.LastPage);

                AssertIsFirstPage(this.unboundedPagingInfo);
                AssertIsLastPage(this.unboundedPagingInfo);

                Assert.AreEqual(this.unboundedPagingInfo.TotalItems, this.unboundedPagingInfo.ItemCount);
                Assert.IsNull(this.unboundedPagingInfo.AllPages);
                Assert.IsTrue(this.unboundedPagingInfo.IsFirstPage);
                Assert.IsTrue(this.unboundedPagingInfo.IsLastPage);
            }
Example #5
0
        internal static void AssertIsFirstPage(PagingInfo firstPageInfo)
        {
            PageNumberAndSizeTests.AssertIsFirstPage(firstPageInfo.CurrentPage);

            Assert.AreEqual(0, firstPageInfo.CurrentPage.Index);
            Assert.AreEqual(
                PageNumberAndSize.FirstPageNumber,
                firstPageInfo.CurrentPage.Number);

            Assert.IsTrue(firstPageInfo.HasValue);
            Assert.IsFalse(firstPageInfo.PreviousPage.HasValue);
            Assert.IsTrue(firstPageInfo.IsFirstPage);

            PageNumberAndSizeTests.AssertEquality(
                firstPageInfo.FirstPage, firstPageInfo.CurrentPage);
        }
Example #6
0
            public void HasValidFirstAndLastPages()
            {
                AssertIsFirstPage(this.defaultPagingInfo);

                PageNumberAndSizeTests.AssertIsFirstPage(this.defaultPagingInfo.CurrentPage);
                PageNumberAndSizeTests.AssertIsFirstPage(this.defaultPagingInfo.FirstPage);

                Assert.Greater(this.defaultPagingInfo.CurrentPage.Size, byte.MinValue);
                Assert.Greater(this.defaultPagingInfo.FirstPage.Size, byte.MinValue);
                Assert.Greater(this.defaultPagingInfo.LastPage.Size, byte.MinValue);

                Assert.IsNull(this.defaultPagingInfo.AllPages);
                Assert.AreEqual(PageNumberAndSize.DefaultPageSize, this.defaultPagingInfo.ItemCount);
                Assert.AreEqual(PageNumberAndSize.DefaultPageSize, this.defaultPagingInfo.CurrentPage.Size);
                Assert.AreEqual(this.defaultPagingInfo.CurrentPage.Size, this.defaultPagingInfo.FirstPage.Size);
                Assert.AreEqual(this.defaultPagingInfo.CurrentPage.Size, this.defaultPagingInfo.LastPage.Size);
                Assert.AreEqual(this.defaultPagingInfo.CurrentPage.Size, this.defaultPagingInfo.ItemCount);
            }
Example #7
0
            public void ReturnsEmptyFromEmpty()
            {
                PageNumberAndSize newPage = PagingInfo.Empty.TurnToPage(6);

                PageNumberAndSizeTests.AssertIsEmpty(newPage);
            }
Example #8
0
 public void HasEmptyNextAndPreviousPages()
 {
     PageNumberAndSizeTests.AssertIsEmpty(this.unboundedPagingInfo.NextPage);
     PageNumberAndSizeTests.AssertIsEmpty(this.unboundedPagingInfo.PreviousPage);
 }