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 22
22
{
23
23
Tag = Uri .UnescapeDataString (Tag );
24
24
blogPosts = (await BlogPostRepository .GetAllAsync (
25
- b => b .Tags .Any (t => t .Content == Tag ),
25
+ b => b .IsPublished && b . Tags .Any (t => t .Content == Tag ),
26
26
b => b .UpdatedDate ))
27
27
.ToList ();
28
28
}
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ public async Task ShouldOnlyDisplayTagsGivenByParameter()
20
20
using var ctx = new TestContext ( ) ;
21
21
await AddBlogPostWithTagAsync ( "Tag 1" ) ;
22
22
await AddBlogPostWithTagAsync ( "Tag 1" ) ;
23
+ await AddBlogPostWithTagAsync ( "Tag 1" , isPublished : false ) ;
23
24
await AddBlogPostWithTagAsync ( "Tag 2" ) ;
24
25
ctx . Services . AddScoped ( _ => Repository ) ;
25
26
ctx . Services . AddScoped ( _ => Mock . Of < IUserRecordService > ( ) ) ;
@@ -61,9 +62,9 @@ public void ShouldSetTitleToTag()
61
62
pageTitle . Markup . Should ( ) . Be ( "Search for tag: Tag" ) ;
62
63
}
63
64
64
- private async Task AddBlogPostWithTagAsync ( string tag )
65
+ private async Task AddBlogPostWithTagAsync ( string tag , bool isPublished = true )
65
66
{
66
- var blogPost = new BlogPostBuilder ( ) . WithTags ( tag ) . Build ( ) ;
67
+ var blogPost = new BlogPostBuilder ( ) . WithTags ( tag ) . IsPublished ( isPublished ) . Build ( ) ;
67
68
await DbContext . AddAsync ( blogPost ) ;
68
69
await DbContext . SaveChangesAsync ( ) ;
69
70
}
You can’t perform that action at this time.
0 commit comments