예제 #1
0
        private void AddPublishedPagesInRegularSiteMap(HttpContextBase context, bool forMobile, XContainer target, IFormattable currentDate)
        {
            string rootUrl = Settings.RootUrl;

            int publishPageCount   = PageCalculator.TotalPage(StoryRepository.CountByPublished(), Settings.HtmlStoryPerPage);
            int publishPageCounter = 1;

            while (publishPageCounter <= publishPageCount)
            {
                target.Add(CreateEntry(context, rootUrl, "Published", new { page = publishPageCounter }, currentDate, SiteMapChangeFrequency.Daily, ((publishPageCounter <= CriticalPriorityPageLimit) ? SiteMapUpdatePriority.Critical : SiteMapUpdatePriority.Normal), forMobile));
                publishPageCounter += 1;
            }
        }
예제 #2
0
        public void CountByPublished_Should_Return_Correct_Result()
        {
            using (BeginTransaction())
            {
                GenerateStories(true, false, true);

                _database.SubmitChanges();


                var count = _storyRepository.CountByPublished();

                Assert.Equal(10, count);
            }
        }
        public void CountByPublished_Should_Return_Correct_Result()
        {
            var story1 = CreateStory();
            var story2 = CreateStory();
            var story3 = CreateStory();

            var rnd = new Random();

            Stories.AddRange(new[] { story1 as Story, story2 as Story, story3 as Story });
            Stories.ForEach(s => s.Publish(SystemTime.Now().AddDays(-rnd.Next(1, 5)), rnd.Next(1, 10)));

            var result = _storyRepository.CountByPublished();

            Assert.Equal(3, result);
        }