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


C# DatabaseObjectProvider.GetMetaTagsForBlog方法代码示例

本文整理汇总了C#中Subtext.Framework.Data.DatabaseObjectProvider.GetMetaTagsForBlog方法的典型用法代码示例。如果您正苦于以下问题:C# DatabaseObjectProvider.GetMetaTagsForBlog方法的具体用法?C# DatabaseObjectProvider.GetMetaTagsForBlog怎么用?C# DatabaseObjectProvider.GetMetaTagsForBlog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subtext.Framework.Data.DatabaseObjectProvider的用法示例。


在下文中一共展示了DatabaseObjectProvider.GetMetaTagsForBlog方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanInsertNewMetaTag

        public void CanInsertNewMetaTag(string content, string name, string httpEquiv, bool withEntry, string errMsg)
        {
            blog = UnitTestHelper.CreateBlogAndSetupContext();
            var repository = new DatabaseObjectProvider();
            int? entryId = null;
            if (withEntry)
            {
                Entry e = UnitTestHelper.CreateEntryInstanceForSyndication("Steven Harman", "My Post", "Foo Bar Zaa!");
                entryId = UnitTestHelper.Create(e);
            }

            MetaTag mt = UnitTestHelper.BuildMetaTag(content, name, httpEquiv, blog.Id, entryId, DateTime.UtcNow);

            // make sure there are no meta-tags for this blog in the data store
            ICollection<MetaTag> tags = repository.GetMetaTagsForBlog(blog, 0, 100);
            Assert.AreEqual(0, tags.Count, "Should be zero MetaTags.");

            // add the meta-tag to the data store
            int tagId = repository.Create(mt);

            tags = repository.GetMetaTagsForBlog(blog, 0, 100);

            Assert.AreEqual(1, tags.Count, errMsg);

            MetaTag newTag = tags.First();

            // make sure all attributes of the meta-tag were written to the data store correctly.
            Assert.AreEqual(tagId, newTag.Id, "Wrong Id");
            Assert.AreEqual(mt.Content, newTag.Content, "Wrong content");
            Assert.AreEqual(mt.Name, newTag.Name, "wrong name attribute");
            Assert.AreEqual(mt.HttpEquiv, newTag.HttpEquiv, "Wrong http-equiv attriubte");
            Assert.AreEqual(mt.BlogId, newTag.BlogId, "Wrong blogId");
            Assert.AreEqual(mt.EntryId, newTag.EntryId, "Wrong entryId");
            Assert.AreEqual(mt.DateCreatedUtc.Date, newTag.DateCreatedUtc.Date, "Wrong created date");
        }
开发者ID:rsaladrigas,项目名称:Subtext,代码行数:35,代码来源:MetaTagInsertTests.cs

示例2: 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

示例3: CanDeleteBlogMetaTag

        public void CanDeleteBlogMetaTag()
        {
            var blog = UnitTestHelper.CreateBlogAndSetupContext();
            var repository = new DatabaseObjectProvider();
            MetaTag tag =
                UnitTestHelper.BuildMetaTag("Steve Harman likes to delete stuff!", "description", null, blog.Id, null,
                                            DateTime.UtcNow);
            repository.Create(tag);
            Assert.AreEqual(1, repository.GetMetaTagsForBlog(blog, 0, 100).Count,
                            "Should be one (1) MetaTag for this blog.");

            // 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.");
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:17,代码来源:MetaTagDeleteTests.cs

示例4: CanGetMetaTagsForBlog

        public void CanGetMetaTagsForBlog()
        {
            blog = UnitTestHelper.CreateBlogAndSetupContext();
            var repository = new DatabaseObjectProvider();
            InsertNewMetaTag("Adding description meta tag", "description", null, DateTime.UtcNow, blog.Id, null);
            InsertNewMetaTag("no-cache", null, "cache-control", DateTime.UtcNow, blog.Id, null);

            ICollection<MetaTag> tags = repository.GetMetaTagsForBlog(blog, 0, 100);

            Assert.AreEqual(2, tags.Count, "Should be two tags for this blog.");
        }
开发者ID:rsaladrigas,项目名称:Subtext,代码行数:11,代码来源:MetaTagGetTests.cs

示例5: CanRemoveHttpEquivAndAddName

        public void CanRemoveHttpEquivAndAddName()
        {
            var blog = UnitTestHelper.CreateBlogAndSetupContext();
            var repository = new DatabaseObjectProvider();
            MetaTag tag = UnitTestHelper.BuildMetaTag("Still nothing to see here.", null, "expires", blog.Id, null, DateTime.UtcNow);
            repository.Create(tag);

            tag.HttpEquiv = null;
            tag.Name = "author";
            tag.Content = "Steve-o-rino!";

            repository.Update(tag);

            ValidateMetaTags(tag, repository.GetMetaTagsForBlog(blog, 0, 100)[0]);
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:15,代码来源:MetaTagUpdateTests.cs

示例6: CanRemoveNameAndAddHttpEquiv

        public void CanRemoveNameAndAddHttpEquiv()
        {
            var blog = UnitTestHelper.CreateBlogAndSetupContext();
            var repository = new DatabaseObjectProvider();
            MetaTag tag = UnitTestHelper.BuildMetaTag("Nothing to see here.", "description", null, blog.Id, null,
                                                      DateTime.UtcNow);
            repository.Create(tag);

            tag.HttpEquiv = "cache-control";
            tag.Name = null;
            tag.Content = "no-cache";

            repository.Update(tag);

            ValidateMetaTags(tag, repository.GetMetaTagsForBlog(blog, 0, 100)[0]);
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:16,代码来源:MetaTagUpdateTests.cs

示例7: GetReturnsZeroWhenNoMetaTagsExistForBlog

 public void GetReturnsZeroWhenNoMetaTagsExistForBlog()
 {
     var repository = new DatabaseObjectProvider();
     blog = UnitTestHelper.CreateBlogAndSetupContext();
     Assert.AreEqual(0, repository.GetMetaTagsForBlog(blog, 0, 100).Count,
                     "Shouldn't have found any MetaTags for this blog.");
 }
开发者ID:rsaladrigas,项目名称:Subtext,代码行数:7,代码来源:MetaTagGetTests.cs

示例8: CanUpdateMetaTag

        public void CanUpdateMetaTag(string content, string name, string httpequiv)
        {
            var blog = UnitTestHelper.CreateBlogAndSetupContext();
            var repository = new DatabaseObjectProvider();
            MetaTag tag = UnitTestHelper.BuildMetaTag(content, name, httpequiv, blog.Id, null, DateTime.UtcNow);
            repository.Create(tag);

            string randomStr = UnitTestHelper.GenerateUniqueString().Left(20);
            tag.Content = content + randomStr;

            if (!string.IsNullOrEmpty(name))
            {
                tag.Name = name + randomStr;
            }

            if (!string.IsNullOrEmpty(httpequiv))
            {
                tag.HttpEquiv = httpequiv + randomStr;
            }

            Assert.IsTrue(repository.Update(tag));

            MetaTag updTag = repository.GetMetaTagsForBlog(blog, 0, 100)[0];

            ValidateMetaTags(tag, updTag);
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:26,代码来源:MetaTagUpdateTests.cs


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