当前位置: 首页>>代码示例>>C#>>正文


C# DatabaseObjectProvider.GetMetaTagsForEntry方法代码示例

本文整理汇总了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.");
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:25,代码来源:MetaTagDeleteTests.cs

示例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.");
        }
开发者ID:rsaladrigas,项目名称:Subtext,代码行数:21,代码来源:MetaTagGetTests.cs

示例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.");
        }
开发者ID:rsaladrigas,项目名称:Subtext,代码行数:15,代码来源:MetaTagGetTests.cs


注:本文中的Subtext.Framework.Data.DatabaseObjectProvider.GetMetaTagsForEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。