本文整理汇总了C#中Subtext.Framework.Data.DatabaseObjectProvider.GetMetaTagsForEntry方法的典型用法代码示例。如果您正苦于以下问题:C# DatabaseObjectProvider.GetMetaTagsForEntry方法的具体用法?C# DatabaseObjectProvider.GetMetaTagsForEntry怎么用?C# DatabaseObjectProvider.GetMetaTagsForEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subtext.Framework.Data.DatabaseObjectProvider
的用法示例。
在下文中一共展示了DatabaseObjectProvider.GetMetaTagsForEntry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanDeleteEntryMetaTag
public void CanDeleteEntryMetaTag()
{
var blog = UnitTestHelper.CreateBlogAndSetupContext();
var repository = new DatabaseObjectProvider();
Entry entry =
UnitTestHelper.CreateEntryInstanceForSyndication("Steven Harman", "Sweet arse entry!",
"Giddy, giddy, goo!");
UnitTestHelper.Create(entry);
MetaTag tag = UnitTestHelper.BuildMetaTag("Foo, bar, zaa?", "author", null, blog.Id, entry.Id, DateTime.UtcNow);
repository.Create(tag);
Assert.AreEqual(1, repository.GetMetaTagsForBlog(blog, 0, 100).Count,
"Should be one (1) MetaTag for this blog.");
Assert.AreEqual(1, repository.GetMetaTagsForEntry(entry, 0, 100).Count,
"Should be one (1) MetaTag for this entry.");
// Now let's remove it from the data store
Assert.IsTrue(repository.DeleteMetaTag(tag.Id), "Deleting the MetaTag failed.");
Assert.AreEqual(0, repository.GetMetaTagsForBlog(blog, 0, 100).Count,
"Should be zero (0) MetaTags for this blog.");
Assert.AreEqual(0, repository.GetMetaTagsForEntry(entry, 0, 100).Count,
"Should be zero (0) MetaTag for this entry.");
}
示例2: CanGetMetaTagsForEntry
public void CanGetMetaTagsForEntry()
{
blog = UnitTestHelper.CreateBlogAndSetupContext();
var repository = new DatabaseObjectProvider();
Entry e = UnitTestHelper.CreateEntryInstanceForSyndication("Steve-o", "Bar",
"Steve is still rockin it... or is he?");
UnitTestHelper.Create(e);
InsertNewMetaTag("Adding description meta tag", "description", null, DateTime.UtcNow, blog.Id, null);
InsertNewMetaTag("no-cache", null, "cache-control", DateTime.UtcNow, blog.Id, null);
// insert a few entry specific tags
InsertNewMetaTag("Yet Another MetaTag", "author", null, DateTime.UtcNow, blog.Id, e.Id);
InsertNewMetaTag("One more for good measure", "description", null, DateTime.UtcNow, blog.Id, e.Id);
InsertNewMetaTag("no-cache", null, "cache-control", DateTime.UtcNow, blog.Id, e.Id);
InsertNewMetaTag("Mon, 22 Jul 2022 11:12:01 GMT", null, "expires", DateTime.UtcNow, blog.Id, e.Id);
ICollection<MetaTag> tags = repository.GetMetaTagsForEntry(e, 0, 100);
Assert.AreEqual(4, tags.Count, "Should have found 4 MetaTags for this entry.");
}
示例3: GetReturnsZeroWhenNoMetaTagsExistForEntry
public void GetReturnsZeroWhenNoMetaTagsExistForEntry()
{
blog = UnitTestHelper.CreateBlogAndSetupContext();
var repository = new DatabaseObjectProvider();
Entry e =
UnitTestHelper.CreateEntryInstanceForSyndication("Steve Harman", "Loves Subtexting!", "Roses are red...");
// Act
UnitTestHelper.Create(e);
// Assert
Assert.AreEqual(0, repository.GetMetaTagsForEntry(e, 0, 100).Count,
"Shouldn't have found any MetaTags for this entry.");
}