本文整理汇总了C#中Subtext.Framework.Data.DatabaseObjectProvider.GetRecentEntries方法的典型用法代码示例。如果您正苦于以下问题:C# DatabaseObjectProvider.GetRecentEntries方法的具体用法?C# DatabaseObjectProvider.GetRecentEntries怎么用?C# DatabaseObjectProvider.GetRecentEntries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subtext.Framework.Data.DatabaseObjectProvider
的用法示例。
在下文中一共展示了DatabaseObjectProvider.GetRecentEntries方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRecentEntries_WithFuturePosts_OnlyReturnsPastPosts
public void GetRecentEntries_WithFuturePosts_OnlyReturnsPastPosts()
{
// Arrange
var repository = new DatabaseObjectProvider();
DateTime utcNow = DateTime.UtcNow.AddDays(-2);
var blog1 = UnitTestHelper.CreateBlogAndSetupContext(null, "subfolder1");
var entryOne = UnitTestHelper.CreateAndSaveEntryForSyndication("me", "blog1-entry-one", "body-zero", null, utcNow, utcNow);
var entryTwo = UnitTestHelper.CreateAndSaveEntryForSyndication("me", "blog1-entry-two", "body-zero", null, utcNow, utcNow.AddDays(10));
var entryThree = UnitTestHelper.CreateAndSaveEntryForSyndication("me", "blog1-entry-three", "body-zero", null, utcNow, utcNow);
var blog2 = UnitTestHelper.CreateBlogAndSetupContext(blog1.Host, "subfolder2");
var entryFour = UnitTestHelper.CreateAndSaveEntryForSyndication("me", "blog2-entry-four", "body-zero", null, utcNow, utcNow.AddDays(10));
var entryFive = UnitTestHelper.CreateAndSaveEntryForSyndication("me", "blog2-entry-five", "body-zero", null, utcNow, utcNow);
UnitTestHelper.WriteTableToOutput("subtext_Config");
UnitTestHelper.WriteTableToOutput("subtext_Content");
// Act
ICollection<Entry> entries = repository.GetRecentEntries(null, null, 10);
// Assert (reverse ordering)
Assert.AreEqual(3, entries.Count);
Assert.AreEqual(entries.First().Id, entryFive.Id);
Assert.AreEqual(entries.ElementAt(1).Id, entryThree.Id);
Assert.AreEqual(entries.ElementAt(2).Id, entryOne.Id);
}