GetPopularEntriesByView() public method

Gets the most popular entries for the blog by the number of page views
public GetPopularEntriesByView ( System.Item blogItem, int maxCount ) : Sitecore.Modules.WeBlog.Items.WeBlog.EntryItem[]
blogItem System.Item The blog to find the most popular pages for
maxCount int The maximum number of entries to return
return Sitecore.Modules.WeBlog.Items.WeBlog.EntryItem[]
Example #1
0
        public void GetPopularEntriesByView_NullItem()
        {
            VerifyAnalyticsSetup();

#if FEATURE_XDB
            var reportProvider = CreateMockReportDataProvider(new ID[0]);
            var manager        = new Mod.EntryManager(reportProvider);
#else
            var manager = new Mod.EntryManager();
#endif

            var entryIds = (from entry in manager.GetPopularEntriesByView(null, 1)
                            select entry.ID).ToArray();

            Assert.AreEqual(0, entryIds.Length);
        }
Example #2
0
        public void GetPopularEntriesByView_ValidItem_Limited()
        {
            VerifyAnalyticsSetup();

#if FEATURE_XDB
            var reportProvider = CreateMockReportDataProvider(new[] { m_entry13.ID, m_entry11.ID, m_entry12.ID });
            var manager        = new Mod.EntryManager(reportProvider);
#else
            var manager = new Mod.EntryManager();
#endif

            var entryIds = (from entry in manager.GetPopularEntriesByView(m_blog1, 1)
                            select entry.ID).ToArray();

            Assert.AreEqual(1, entryIds.Length);
            Assert.AreEqual(m_entry13.ID, entryIds[0]);
        }
Example #3
0
        public void GetPopularEntriesByView_NullItem()
        {
            VerifyAnalyticsSetup();

#if FEATURE_XDB
            var reportProvider = CreateMockReportDataProvider(new ID[0]);
            var manager = new Mod.EntryManager(reportProvider);
#else
            var manager = new Mod.EntryManager();
#endif

            var entryIds = (from entry in manager.GetPopularEntriesByView(null, 1)
                            select entry.ID).ToArray();

            Assert.AreEqual(0, entryIds.Length);            
        }
Example #4
0
        public void GetPopularEntriesByView_ValidItem_Limited()
        {
            VerifyAnalyticsSetup();

#if FEATURE_XDB
            var reportProvider = CreateMockReportDataProvider(new[] { m_entry13.ID, m_entry11.ID, m_entry12.ID });
            var manager = new Mod.EntryManager(reportProvider);
#else
            var manager = new Mod.EntryManager();
#endif

            var entryIds = (from entry in manager.GetPopularEntriesByView(m_blog1, 1)
                            select entry.ID).ToArray();

            Assert.AreEqual(1, entryIds.Length);
            Assert.AreEqual(m_entry13.ID, entryIds[0]);
        }