示例#1
0
        public void GetPagingTest_If_page_is_zero_or_smaller_returns_throws()
        {
            var paging = new PagingService();

            Exception ex = Assert.Throws <PagingExeption>(() => paging.GetPaging(_inputDialogues, 0));

            Assert.Equal(ex.Message, "Page is not be zero or smaller");
        }
示例#2
0
        public void GetPagingTest_If_page_is_too_large_returns_throws()
        {
            var paging = new PagingService();

            Exception ex = Assert.Throws <PagingExeption>(() => paging.GetPaging(_inputDialogues, 2));

            Assert.Equal(ex.Message, "Page is too large");
        }
示例#3
0
        public void GetPagingTest_If_collectio_is_null_should_be_returns_throws()
        {
            var paging = new PagingService();

            Exception ex = Assert.Throws <PagingExeption>(() => paging.GetPaging((IEnumerable <Dialogue>)null));

            Assert.Equal(ex.Message, "Collection data is not exist");
        }
示例#4
0
        public void GetPagingTest_changeSizePage(int sizePage, int dataCount, bool nextPage)
        {
            var paging = new PagingService();
            var result = paging.GetPaging(_inputDialogues, pageSize: sizePage);

            Assert.True(result.Data.Count() == dataCount);
            Assert.True(result.Count == _inputDialogues.Count());
            Assert.True(result.Page == 1);
            Assert.True(result.NextPage == nextPage);
            Assert.False(result.PreviousPage);
            Assert.True(result.PageSize == sizePage);
        }
示例#5
0
        public void GetPagingTest()
        {
            var paging = new PagingService();
            var result = paging.GetPaging(_inputDialogues);

            Assert.True(result.Data.Count() == _inputDialogues.Count());
            Assert.True(result.Count == _inputDialogues.Count());
            Assert.True(result.Page == 1);
            Assert.False(result.NextPage);
            Assert.False(result.PreviousPage);
            Assert.True(result.PageSize == 20);
        }
示例#6
0
        public void GetPagingTest_changePage(int page, int sizeData, bool nextPage, bool previousPage, string firstElementName, string lastElementName)
        {
            const int sizePage = 3;

            var paging = new PagingService();
            var result = paging.GetPaging(_inputDialogues, page, sizePage);

            Assert.Equal(result.Data.Count(), sizeData);
            Assert.Equal(result.Data.First().Name, firstElementName);
            Assert.Equal(result.Data.Last().Name, lastElementName);
            Assert.Equal(result.Count, _inputDialogues.Count());
            Assert.Equal(result.Page, page);
            Assert.Equal(result.NextPage, nextPage);
            Assert.Equal(result.PreviousPage, previousPage);
            Assert.Equal(result.PageSize, 3);
        }