public void CountByUpcoming_Should_Return_Correct_Result()
        {
            var story1 = CreateStory();
            var story2 = CreateStory();
            var story3 = CreateStory();

            Stories.AddRange(new[] { story1 as Story, story2 as Story, story3 as Story });

            var result = _storyRepository.CountByUpcoming();

            Assert.Equal(3, result);
        }
Ejemplo n.º 2
0
        private void AddUpcomingPagesInRegularSiteMap(HttpContextBase context, bool forMobile, XContainer target, IFormattable currentDate)
        {
            string rootUrl = Settings.RootUrl;

            int upcomingPageCount   = PageCalculator.TotalPage(StoryRepository.CountByUpcoming(), Settings.HtmlStoryPerPage);
            int upcomingPageCounter = 1;

            while (upcomingPageCounter <= upcomingPageCount)
            {
                target.Add(CreateEntry(context, rootUrl, "Upcoming", new { page = upcomingPageCounter }, currentDate, SiteMapChangeFrequency.Hourly, ((upcomingPageCounter <= CriticalPriorityPageLimit) ? SiteMapUpdatePriority.High : SiteMapUpdatePriority.Normal), forMobile));
                upcomingPageCounter += 1;
            }
        }
Ejemplo n.º 3
0
        public void CountByUpcoming_Should_Return_Correct_Result()
        {
            using (BeginTransaction())
            {
                GenerateStories(false, false, true);

                _database.SubmitChanges();

                var count = _storyRepository.CountByUpcoming();

                Assert.True(count >= 10);
            }
        }
Ejemplo n.º 4
0
        public T AssignViewData <T>(T data) where T : BaseViewData
        {
            data.SiteTitle                  = Settings.SiteTitle;
            data.RootUrl                    = Settings.RootUrl;
            data.MetaKeywords               = Settings.MetaKeywords;
            data.MetaDescription            = Settings.MetaDescription;
            data.IsCurrentUserAuthenticated = IsCurrentUserAuthenticated;
            data.CurrentUser                = CurrentUser;
            data.UpcomingStoriesCount       = StoryRepository.CountByUpcoming();
            data.FacebookAppId              = Settings.FacebookAppId;

            return(data);
        }