File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
LinkDotNet.Blog.IntegrationTests/Web/Pages
LinkDotNet.Blog.Web/Pages Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change 7
7
using LinkDotNet . Blog . Web . Pages ;
8
8
using LinkDotNet . Infrastructure . Persistence ;
9
9
using Microsoft . Extensions . DependencyInjection ;
10
+ using Moq ;
11
+ using Toolbelt . Blazor . HeadElement ;
10
12
using Xunit ;
11
13
12
14
namespace LinkDotNet . Blog . IntegrationTests . Web . Pages
@@ -21,6 +23,7 @@ public async Task ShouldOnlyDisplayTagsGivenByParameter()
21
23
await AddBlogPostWithTagAsync ( "Tag 1" ) ;
22
24
await AddBlogPostWithTagAsync ( "Tag 2" ) ;
23
25
ctx . Services . AddScoped < IRepository > ( _ => BlogPostRepository ) ;
26
+ ctx . Services . AddScoped ( _ => new Mock < IHeadElementHelper > ( ) . Object ) ;
24
27
var cut = ctx . RenderComponent < SearchByTag > ( p => p . Add ( s => s . Tag , "Tag 1" ) ) ;
25
28
cut . WaitForState ( ( ) => cut . FindAll ( ".blog-card" ) . Any ( ) ) ;
26
29
@@ -35,6 +38,7 @@ public async Task ShouldHandleSpecialCharacters()
35
38
using var ctx = new TestContext ( ) ;
36
39
await AddBlogPostWithTagAsync ( "C#" ) ;
37
40
ctx . Services . AddScoped < IRepository > ( _ => BlogPostRepository ) ;
41
+ ctx . Services . AddScoped ( _ => new Mock < IHeadElementHelper > ( ) . Object ) ;
38
42
var cut = ctx . RenderComponent < SearchByTag > ( p => p . Add ( s => s . Tag , Uri . EscapeDataString ( "C#" ) ) ) ;
39
43
cut . WaitForState ( ( ) => cut . FindAll ( ".blog-card" ) . Any ( ) ) ;
40
44
Original file line number Diff line number Diff line change 1
1
@page " /searchByTag/{tag}"
2
2
@using LinkDotNet .Domain
3
3
@using LinkDotNet .Infrastructure .Persistence
4
+ @using Toolbelt .Blazor .HeadElement
4
5
@inject IRepository repository
5
6
7
+ <Title >Search for tag: @Tag </Title >
6
8
<h3 >All posts with Tag <em >@Tag </em ></h3 >
7
9
8
10
@for ( var i = 0 ; i < blogPosts .Count ; i ++ )
You can’t perform that action at this time.
0 commit comments