本文整理汇总了C#中PageModel.List方法的典型用法代码示例。如果您正苦于以下问题:C# PageModel.List方法的具体用法?C# PageModel.List怎么用?C# PageModel.List使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageModel
的用法示例。
在下文中一共展示了PageModel.List方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: List_Should_Use_Paging
public void List_Should_Use_Paging()
{
var repository = new Mock();
repository.Setup("List", null);
var model = new PageModel();
model.Repository = repository;
model.List(2, 20);
Assert.AreEqual(2, model.Value.PageNo);
Assert.AreEqual(20,model.Value.PageSize);
repository.Verify();
}
示例2: get_pages_by_tag
public static dynamic get_pages_by_tag(dynamic data)
{
var tag = data as string;
dynamic list = new List<dynamic>();
if (tag != null)
{
var model = new PageModel();
list = model.List(1, 20, (p) =>
{
if (!p.HasProperty("Tags")) return false;
object[] tags = ((dynamic)p).Tags;
return tags == null ? false : tags.Any(t => t.Equals(tag));
}).Value.List;
}
return list;
}
示例3: List_Should_Use_Paging_Filter
public void List_Should_Use_Paging_Filter()
{
var list = new List<ExpandoObject>();
for (int i = 0; i < 50; i++)
{
dynamic item = new ExpandoObject();
item.Title = i.ToString();
list.Add(item);
}
var repository = new Mock();
repository.Setup("List", null, list);
var model = new PageModel();
model.Repository = repository;
model.List(1, 20, (p)=>((dynamic)p).Title.StartsWith("2"));
Assert.AreEqual(1, model.Value.PageNo);
Assert.AreEqual(20, model.Value.PageSize);
IEnumerable<ExpandoObject> ret = model.Value.List;
Assert.AreEqual(20, ret.Count()); //should be 11, if model handles the filter
repository.Verify();
}