File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 11#nullable enable
2+ Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory<TEntryPoint>.Initialize() -> void
23Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory<TEntryPoint>.Server.get -> Microsoft.AspNetCore.TestHost.TestServer?
34Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory<TEntryPoint>.TestServer.get -> Microsoft.AspNetCore.TestHost.ITestServer?
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ public ITestServer? TestServer
9393 {
9494 get
9595 {
96- EnsureServer ( ) ;
96+ Initialize ( ) ;
9797 return _server ! ;
9898 }
9999 }
@@ -105,7 +105,7 @@ public virtual IServiceProvider Services
105105 {
106106 get
107107 {
108- EnsureServer ( ) ;
108+ Initialize ( ) ;
109109 return _host ? . Services ?? _server . Host . Services ;
110110 }
111111 }
@@ -154,7 +154,11 @@ internal virtual WebApplicationFactory<TEntryPoint> WithWebHostBuilderCore(Actio
154154 return factory ;
155155 }
156156
157- private void EnsureServer ( )
157+ /// <summary>
158+ /// Initializes the instance by configurating the host builder.
159+ /// </summary>
160+ /// <exception cref="InvalidOperationException">Thrown if the provided <see cref="TEntryPoint"/> type has no factory method.</exception>
161+ public void Initialize ( )
158162 {
159163 if ( _server != null )
160164 {
@@ -493,7 +497,7 @@ public HttpClient CreateClient(WebApplicationFactoryClientOptions options) =>
493497 /// <returns>The <see cref="HttpClient"/>.</returns>
494498 public HttpClient CreateDefaultClient ( params DelegatingHandler [ ] handlers )
495499 {
496- EnsureServer ( ) ;
500+ Initialize ( ) ;
497501
498502 HttpClient client ;
499503 if ( handlers == null || handlers . Length == 0 )
You can’t perform that action at this time.
0 commit comments