From cabb9f9afc0b48615c677741898329ef2b2aab0b Mon Sep 17 00:00:00 2001 From: Ian Griffiths Date: Fri, 13 Jan 2023 12:08:08 +0000 Subject: [PATCH] Add ability to stop in-memory hosts --- .../OpenApiWebHostManager.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Solutions/Menes.Testing.AspNetCoreSelfHosting/Menes/Testing/AspNetCoreSelfHosting/OpenApiWebHostManager.cs b/Solutions/Menes.Testing.AspNetCoreSelfHosting/Menes/Testing/AspNetCoreSelfHosting/OpenApiWebHostManager.cs index 193a3e42..0e3173ae 100644 --- a/Solutions/Menes.Testing.AspNetCoreSelfHosting/Menes/Testing/AspNetCoreSelfHosting/OpenApiWebHostManager.cs +++ b/Solutions/Menes.Testing.AspNetCoreSelfHosting/Menes/Testing/AspNetCoreSelfHosting/OpenApiWebHostManager.cs @@ -59,7 +59,7 @@ public class OpenApiWebHostManager /// your startup class has executed. You can use this to swap out services for stubs or fakes. /// /// A representing the asynchronous operation. - public Task StartInProcessFunctionsHostAsync( + public Task StartInProcessFunctionsHostAsync( string baseUrl, Action? additionalServiceConfigurationCallback = null) where TFunctionStartup : class, IWebJobsStartup, new() @@ -78,7 +78,7 @@ public Task StartInProcessFunctionsHostAsync( /// your startup class has executed. You can use this to swap out services for stubs or fakes. /// /// A representing the asynchronous operation. - public Task StartInProcessFunctionsHostAsync( + public Task StartInProcessFunctionsHostAsync( string baseUrl, IConfiguration configuration, Action? additionalServiceConfigurationCallback = null) @@ -98,7 +98,7 @@ public Task StartInProcessFunctionsHostAsync( /// your startup class has executed. You can use this to swap out services for stubs or fakes. /// /// A representing the asynchronous operation. - public Task StartInProcessFunctionsHostAsync( + public Task StartInProcessFunctionsHostAsync( TFunctionStartup startupInstance, string baseUrl, Action? additionalServiceConfigurationCallback = null) @@ -136,7 +136,7 @@ public Task StartInProcessFunctionsHostAsync( /// your startup class has executed. You can use this to swap out services for stubs or fakes. /// /// A representing the asynchronous operation. - public Task StartInProcessFunctionsHostAsync( + public Task StartInProcessFunctionsHostAsync( TFunctionStartup startupInstance, string baseUrl, IConfiguration configuration, @@ -184,7 +184,7 @@ public Task StartInProcessFunctionsHostAsync( /// because that's the only way to ensure that your configuration will run after Startup. (The ASP.NET /// web host startup prefers to run the Startup methods after all other configuration has occurred.) /// - public Task StartInProcessAspNetHostAsync( + public Task StartInProcessAspNetHostAsync( string baseUrl, TStartup startupInstance) where TStartup : class @@ -217,7 +217,7 @@ public async Task StopAllHostsAsync() /// A callback that will allow you to configure the for your service. /// /// A representing the asynchronous operation. - private Task StartAspNetHostAsync( + private async Task StartAspNetHostAsync( string baseUrl, Action serviceConfigurationCallback, Action webHostBuilderCallback) @@ -242,7 +242,8 @@ private Task StartAspNetHostAsync( this.webHosts.Add(host); - return host.StartAsync(); + await host.StartAsync(); + return host; } } } \ No newline at end of file