本文整理汇总了C#中PagedList.ToPagingLinks方法的典型用法代码示例。如果您正苦于以下问题:C# PagedList.ToPagingLinks方法的具体用法?C# PagedList.ToPagingLinks怎么用?C# PagedList.ToPagingLinks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PagedList
的用法示例。
在下文中一共展示了PagedList.ToPagingLinks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GivenThatPagedListContainsPreviousPage_WhenCreatingPagingLinks_ThenListOfLinksContainsPreviousLink
public void GivenThatPagedListContainsPreviousPage_WhenCreatingPagingLinks_ThenListOfLinksContainsPreviousLink()
{
IPagedList<int> pagedList = new PagedList<int>(new List<int> { 1, 2, 3 }.AsQueryable(), 3, 1);
var urlHelper = MockRepository.GenerateMock<UrlHelper>();
urlHelper.Stub(x => x.Link(Arg<string>.Is.Anything, Arg<object>.Is.Anything)).Return("https://localhost.com");
var pagingLinks = pagedList.ToPagingLinks(urlHelper, "SomeRouteName").ToList();
Assert.AreEqual(3, pagingLinks.Count);
Assert.IsTrue(pagingLinks.Exists(x => x.Relation.Equals("prev")));
}
示例2: GivenThatUrlHelperIsNull_WhenCreatingPagingLinks_ThenArgumentNullExceptionIsThrown
public void GivenThatUrlHelperIsNull_WhenCreatingPagingLinks_ThenArgumentNullExceptionIsThrown()
{
IPagedList<int> pagedList = new PagedList<int>(new List<int> { 1, 2, 3 }.AsQueryable(), 1, 1);
pagedList.ToPagingLinks(null, "routeName");
}