GetMetaTagsForEntry() public method

public GetMetaTagsForEntry ( Entry entry, int pageIndex, int pageSize ) : IPagedCollection
entry Subtext.Framework.Components.Entry
pageIndex int
pageSize int
return IPagedCollection
コード例 #1
0
        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
0
        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
0
        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.");
        }