File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
src/LinkDotNet.Blog.Web/Features/SearchByTag
tests/LinkDotNet.Blog.IntegrationTests/Web/Features/SearchByTag Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 2222 {
2323 Tag = Uri .UnescapeDataString (Tag );
2424 blogPosts = (await BlogPostRepository .GetAllAsync (
25- b => b .Tags .Any (t => t .Content == Tag ),
25+ b => b .IsPublished && b . Tags .Any (t => t .Content == Tag ),
2626 b => b .UpdatedDate ))
2727 .ToList ();
2828 }
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ public async Task ShouldOnlyDisplayTagsGivenByParameter()
2020 using var ctx = new TestContext ( ) ;
2121 await AddBlogPostWithTagAsync ( "Tag 1" ) ;
2222 await AddBlogPostWithTagAsync ( "Tag 1" ) ;
23+ await AddBlogPostWithTagAsync ( "Tag 1" , isPublished : false ) ;
2324 await AddBlogPostWithTagAsync ( "Tag 2" ) ;
2425 ctx . Services . AddScoped ( _ => Repository ) ;
2526 ctx . Services . AddScoped ( _ => Mock . Of < IUserRecordService > ( ) ) ;
@@ -61,9 +62,9 @@ public void ShouldSetTitleToTag()
6162 pageTitle . Markup . Should ( ) . Be ( "Search for tag: Tag" ) ;
6263 }
6364
64- private async Task AddBlogPostWithTagAsync ( string tag )
65+ private async Task AddBlogPostWithTagAsync ( string tag , bool isPublished = true )
6566 {
66- var blogPost = new BlogPostBuilder ( ) . WithTags ( tag ) . Build ( ) ;
67+ var blogPost = new BlogPostBuilder ( ) . WithTags ( tag ) . IsPublished ( isPublished ) . Build ( ) ;
6768 await DbContext . AddAsync ( blogPost ) ;
6869 await DbContext . SaveChangesAsync ( ) ;
6970 }
You can’t perform that action at this time.
0 commit comments