File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
LinkDotNet.Blog.IntegrationTests/Web/Shared
LinkDotNet.Blog.Web/Shared Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change
1
+ using Bunit ;
2
+ using Bunit . TestDoubles ;
3
+ using FluentAssertions ;
4
+ using LinkDotNet . Blog . Web ;
5
+ using LinkDotNet . Blog . Web . Shared ;
6
+ using Microsoft . AspNetCore . Components ;
7
+ using Microsoft . Extensions . DependencyInjection ;
8
+ using Xunit ;
9
+
10
+ namespace LinkDotNet . Blog . IntegrationTests . Web . Shared
11
+ {
12
+ public class NavMenuTests : TestContext
13
+ {
14
+ [ Fact ]
15
+ public void ShouldNavigateToSearchPage ( )
16
+ {
17
+ Services . AddScoped ( _ => new AppConfiguration ( ) ) ;
18
+ this . AddTestAuthorization ( ) ;
19
+ var navigationManager = Services . GetRequiredService < NavigationManager > ( ) ;
20
+ var cut = RenderComponent < NavMenu > ( ) ;
21
+ cut . FindComponent < SearchInput > ( ) . Find ( "input" ) . Change ( "Text" ) ;
22
+
23
+ cut . FindComponent < SearchInput > ( ) . Find ( "button" ) . Click ( ) ;
24
+
25
+ navigationManager . Uri . Should ( ) . EndWith ( "search/Text" ) ;
26
+ }
27
+ }
28
+ }
Original file line number Diff line number Diff line change 31
31
@code {
32
32
private void NavigateToSearchPage (string searchTerm )
33
33
{
34
- navigationManager .NavigateTo ($" search/{searchTerm }" );
34
+ var escapeDataString = Uri .EscapeDataString (searchTerm );
35
+ navigationManager .NavigateTo ($" search/{escapeDataString }" );
35
36
}
36
37
}
You can’t perform that action at this time.
0 commit comments