GetBlogEntries() private method

private GetBlogEntries ( ) : Sitecore.Modules.WeBlog.Items.WeBlog.EntryItem[]
return Sitecore.Modules.WeBlog.Items.WeBlog.EntryItem[]
Esempio n. 1
0
 public void GetBlogEntries_NullItem()
 {
     var manager = new EntryManager();
     var entries = manager.GetBlogEntries((Item)null);
     Assert.That(entries, Is.Empty);
 }
Esempio n. 2
0
        public void GetBlogEntries_WithEntriesMultipleBlogs()
        {
            var blog1 = TestUtil.CreateNewBlog(TestContentRoot);
            var entryLuna = TestUtil.CreateNewEntry(blog1, "Luna", entryDate: new DateTime(2012, 3, 1));
            var entryDeimos = TestUtil.CreateNewEntry(blog1, "Deimos", entryDate: new DateTime(2012, 3, 2));
            var entryPhobos = TestUtil.CreateNewEntry(blog1, "Phobos", entryDate: new DateTime(2012, 3, 3));

            var blog2 = TestUtil.CreateNewBlog(TestContentRoot);
            TestUtil.CreateNewEntry(blog2, "Adrastea");
            TestUtil.CreateNewEntry(blog2, "Aitne");
            TestUtil.CreateNewEntry(blog2, "Amalthea");
            TestUtil.CreateNewEntry(blog2, "Ananke");
            TestUtil.UpdateIndex();

            var manager = new EntryManager();
            var results = manager.GetBlogEntries(entryDeimos);
            var ids = from result in results select result.ID;

            Assert.That(ids, Is.EqualTo(new[] { entryPhobos.ID, entryDeimos.ID, entryLuna.ID }));
        }
Esempio n. 3
0
        public void GetBlogEntries_LimitEntriesZero()
        {
            var blog = TestUtil.CreateNewBlog(TestContentRoot);
            var entryLuna = TestUtil.CreateNewEntry(blog, "Luna", entryDate: new DateTime(2012, 3, 1));
            var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos", entryDate: new DateTime(2012, 3, 2));
            var entryPhobos = TestUtil.CreateNewEntry(blog, "Phobos", entryDate: new DateTime(2012, 3, 3));
            var entryAdrastea = TestUtil.CreateNewEntry(blog, "Adrastea", entryDate: new DateTime(2012, 3, 4));
            TestUtil.UpdateIndex();

            var manager = new EntryManager();
            var results = manager.GetBlogEntries(blog, 0, null, null, null, null);

            Assert.That(results, Is.Empty);
        }
Esempio n. 4
0
        public void GetBlogEntries_NoEntries()
        {
            var blog = TestUtil.CreateNewBlog(TestContentRoot);

            var manager = new EntryManager();
            var entries = manager.GetBlogEntries(blog);
            Assert.That(entries, Is.Empty);
        }
Esempio n. 5
0
        public void GetBlogEntries_LimitEntries()
        {
            var blog = TestUtil.CreateNewBlog(TestContentRoot);
            var entryLuna = TestUtil.CreateNewEntry(blog, "Luna", entryDate: new DateTime(2012, 3, 1));
            var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos", entryDate: new DateTime(2012, 3, 2));
            var entryPhobos = TestUtil.CreateNewEntry(blog, "Phobos", entryDate: new DateTime(2012, 3, 3));
            var entryAdrastea = TestUtil.CreateNewEntry(blog, "Adrastea", entryDate: new DateTime(2012, 3, 4));
            TestUtil.UpdateIndex();

            var manager = new EntryManager();
            var results = manager.GetBlogEntries(blog, 2, null, null, null, null);
            var ids = from result in results select result.ID;

            Assert.That(ids, Is.EqualTo(new[] { entryAdrastea.ID, entryPhobos.ID }));
        }
Esempio n. 6
0
        public void GetBlogEntries_ByTagWithSpace()
        {
            var blog = TestUtil.CreateNewBlog(TestContentRoot);
            var entryLuna = TestUtil.CreateNewEntry(blog, "Luna", tags: "wheeljack, prowl", entryDate: new DateTime(2012, 3, 1));
            var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos", tags: "prowl, orion pax, cliffjumper", entryDate: new DateTime(2012, 3, 2));
            var entryPhobos = TestUtil.CreateNewEntry(blog, "Phobos", tags: "wheeljack, hot rod, orion pax", entryDate: new DateTime(2012, 3, 3));
            TestUtil.UpdateIndex();

            var manager = new EntryManager();
            var results = manager.GetBlogEntries(blog, 10, "orion pax", null, null, null);
            var ids = from result in results select result.ID;

            Assert.That(ids, Is.EqualTo(new[] { entryPhobos.ID, entryDeimos.ID }));
        }
Esempio n. 7
0
        public void GetBlogEntries_ByInvalidTag()
        {
            var blog = TestUtil.CreateNewBlog(TestContentRoot);
            var entryLuna = TestUtil.CreateNewEntry(blog, "Luna", tags: "wheeljack, prowl", entryDate: new DateTime(2012, 3, 1));
            var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos", tags: "prowl, orion pax, cliffjumper", entryDate: new DateTime(2012, 3, 2));
            var entryPhobos = TestUtil.CreateNewEntry(blog, "Phobos", tags: "wheeljack, hot rod, orion pax", entryDate: new DateTime(2012, 3, 3));
            var entryAdrastea = TestUtil.CreateNewEntry(blog, "Adrastea", tags: "wheeljack, hot rod, orion pax, prowl", entryDate: new DateTime(2012, 3, 4));
            TestUtil.UpdateIndex();

            var manager = new EntryManager();
            var results = manager.GetBlogEntries(blog, 10, "blurr", null, null, null);

            Assert.That(results, Is.Empty);
        }
Esempio n. 8
0
        public void GetBlogEntries_ByInvalidCategory()
        {
            var blog = TestUtil.CreateNewBlog(TestContentRoot);
            var categoryAlpha = TestUtil.CreateNewCategory(blog, "Alpha");
            var categoryBeta = TestUtil.CreateNewCategory(blog, "Beta");
            var entryLuna = TestUtil.CreateNewEntry(blog, "Luna", categories: new[] { categoryBeta.ID }, entryDate: new DateTime(2012, 3, 1));
            var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos", categories: new[] { categoryAlpha.ID, categoryBeta.ID }, entryDate: new DateTime(2012, 3, 2));
            var entryPhobos = TestUtil.CreateNewEntry(blog, "Phobos", categories: new[] { categoryBeta.ID, categoryAlpha.ID }, entryDate: new DateTime(2012, 3, 3));
            var entryAdrastea = TestUtil.CreateNewEntry(blog, "Adrastea", categories: new[] { categoryBeta.ID, categoryAlpha.ID }, entryDate: new DateTime(2012, 3, 4));
            TestUtil.UpdateIndex();

            var manager = new EntryManager();
            var results = manager.GetBlogEntries(blog, 10, null, ID.NewID.ToString(), null, null);

            Assert.That(results, Is.Empty);
        }
Esempio n. 9
0
        public void GetBlogEntries_ByCategoryLimited()
        {
            var blog = TestUtil.CreateNewBlog(TestContentRoot);
            var categoryAlpha = TestUtil.CreateNewCategory(blog, "Alpha");
            var categoryBeta = TestUtil.CreateNewCategory(blog, "Beta");
            var entryLuna = TestUtil.CreateNewEntry(blog, "Luna", categories: new[] { categoryBeta.ID }, entryDate: new DateTime(2012, 3, 1));
            var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos", categories: new[] { categoryAlpha.ID, categoryBeta.ID }, entryDate: new DateTime(2012, 3, 2));
            var entryPhobos = TestUtil.CreateNewEntry(blog, "Phobos", categories: new[] { categoryBeta.ID, categoryAlpha.ID }, entryDate: new DateTime(2012, 3, 3));
            var entryAdrastea = TestUtil.CreateNewEntry(blog, "Adrastea", categories: new[] { categoryBeta.ID, categoryAlpha.ID }, entryDate: new DateTime(2012, 3, 4));
            TestUtil.UpdateIndex();

            var manager = new EntryManager();
            var results = manager.GetBlogEntries(blog, 1, null, categoryAlpha.ID.ToString(), null, null);
            var ids = from result in results select result.ID;

            Assert.That(ids, Is.EqualTo(new[] { entryAdrastea.ID }));
        }