File tree 1 file changed +13
-4
lines changed
src/Mvc/Mvc.TagHelpers/test
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -77,9 +77,6 @@ private static TagHelperOutput GetTagHelperOutput()
77
77
78
78
private ViewContext GetViewContext ( )
79
79
{
80
- var navManager = new Mock < NavigationManager > ( ) ;
81
- navManager . As < IHostEnvironmentNavigationManager > ( ) ;
82
-
83
80
var httpContext = new DefaultHttpContext
84
81
{
85
82
RequestServices = new ServiceCollection ( )
@@ -89,7 +86,7 @@ private ViewContext GetViewContext()
89
86
x => x . CreateProtector ( It . IsAny < string > ( ) ) == Mock . Of < IDataProtector > ( ) ) )
90
87
. AddLogging ( )
91
88
. AddScoped < ComponentStatePersistenceManager > ( )
92
- . AddScoped ( _ => navManager . Object )
89
+ . AddScoped < NavigationManager , MockNavigationManager > ( )
93
90
. AddScoped < HttpContextFormDataProvider > ( )
94
91
. BuildServiceProvider ( ) ,
95
92
} ;
@@ -104,4 +101,16 @@ protected override void BuildRenderTree(RenderTreeBuilder builder)
104
101
builder . AddContent ( 0 , "Hello from the component" ) ;
105
102
}
106
103
}
104
+
105
+ class MockNavigationManager : NavigationManager , IHostEnvironmentNavigationManager
106
+ {
107
+ public MockNavigationManager ( )
108
+ {
109
+ Initialize ( "https://localhost:85/subdir/" , "https://localhost:85/subdir/path?query=value#hash" ) ;
110
+ }
111
+
112
+ void IHostEnvironmentNavigationManager . Initialize ( string baseUri , string uri )
113
+ {
114
+ }
115
+ }
107
116
}
You can’t perform that action at this time.
0 commit comments