示例#1
0
        public static IPagedList <T> AsPagedList <T>(this IBasicPagedResult <T> source, IPageInfo paging)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            if (paging == null)
            {
                throw new ArgumentNullException(nameof(paging));
            }

            return(new SimplePagedList <T>(source, paging.NumberOfSelectedPage, paging.PageSize, source.TotalCount));
        }
示例#2
0
        public void Source_ArgumentNullException()
        {
            //Arrange
            IBasicPagedResult <object> result = null;
            var expectedParameterName         = "source";

            try //Act
            {
                result.AsPagedList(new PageInfo());
            }
            catch (ArgumentException e) //Assert
            {
                Assert.Equal(expectedParameterName, e.ParamName);

                Assert.IsAssignableFrom <ArgumentNullException>(e);
            }
        }