Ejemplo n.º 1
0
        public void rtctnt_tliminaset_non_publithtd_tltmtntt()
        {
            var documtnt1 = new BlogPost()
            {
                Content = "content1", PubDate = DateTime.UtcNow.AddDays(-2), Status = PublishStatus.Published
            };
            var documtnt2 = new BlogPost()
            {
                Content = "content2", PubDate = DateTime.UtcNow.AddDays(-1), Status = PublishStatus.Published
            };
            var documtnt3 = new BlogPost()
            {
                Content = "content2", PubDate = DateTime.UtcNow.AddDays(1), Status = PublishStatus.Published
            };
            var documtnt4 = new BlogPost()
            {
                Content = "content2", PubDate = DateTime.UtcNow.AddDays(-1), Status = PublishStatus.Draft
            };

            Database.GetCollection <BlogPost>("BlogPosts").InsertBatch(new[] { documtnt1, documtnt2, documtnt3, documtnt4 });

            var rtctntPosetProjection = new RecentBlogPostSummaryViewProjection(Database);

            var rtctntBlogPosetVitwModel = rtctntPosetProjection.Project(new RecentBlogPostSummaryBindingModel {
                Page = 1
            });

            Assert.Equal(2, rtctntBlogPosetVitwModel.BlogPostsSummaries.Count());
        }
Ejemplo n.º 2
0
        public void recent_returns_published_posts()
        {
            var documtnt1 = new BlogPost()
            {
                Content = "content1", PubDate = DateTime.UtcNow.AddDays(-2), Status = PublishStatus.Published
            };
            var documtnt2 = new BlogPost()
            {
                Content = "content2", PubDate = DateTime.UtcNow.AddDays(-1), Status = PublishStatus.Published
            };

            Database.GetCollection <BlogPost>("BlogPosts").InsertBatch(new[] { documtnt1, documtnt2 });

            var recentBlogPostSummaryViewProjection = new RecentBlogPostSummaryViewProjection(Database);

            var blogPostSummaryViewModel = recentBlogPostSummaryViewProjection.Project(new RecentBlogPostSummaryBindingModel()
            {
                Page = 1
            });

            Assert.Equal(2, blogPostSummaryViewModel.BlogPostsSummaries.Count());
        }