diff --git a/src/Hosuto.Testing.AspNetCore/Modules/Testing/WebModuleFactory.cs b/src/Hosuto.Testing.AspNetCore/Modules/Testing/WebModuleFactory.cs index 8036eaa..e399894 100644 --- a/src/Hosuto.Testing.AspNetCore/Modules/Testing/WebModuleFactory.cs +++ b/src/Hosuto.Testing.AspNetCore/Modules/Testing/WebModuleFactory.cs @@ -28,8 +28,8 @@ public class WebModuleFactory : IDisposable where TModule : class, IWeb private TestServer _server; private IHost _host; private Action _configuration; - private IList _clients = new List(); - private List> _derivedFactories = + private readonly IList _clients = new List(); + private readonly List> _derivedFactories = new List>(); /// @@ -136,6 +136,28 @@ internal virtual WebModuleFactory WithWebHostBuilderCore(Action WithModuleHostBuilder(Action configure) + { + var factory = new DelegatedWebApplicationFactory( + ClientOptions, + CreateServer, + CreateHost, + () => + { + var builder = CreateModuleHostBuilder(); + configure(builder); + return builder; + }, + GetTestAssemblies, + ConfigureClient, + ConfigureWebHost, + ConfigureModule); + + _derivedFactories.Add(factory); + + return factory; + } + public WebModuleFactory WithModuleConfiguration(Action options) { var factory = new DelegatedWebApplicationFactory( diff --git a/test/Hosuto.Hosting.AspNetCore.Tests/Hosuto.Hosting.AspNetCore.Tests.csproj b/test/Hosuto.Hosting.AspNetCore.Tests/Hosuto.Hosting.AspNetCore.Tests.csproj index 057356f..b66be8a 100644 --- a/test/Hosuto.Hosting.AspNetCore.Tests/Hosuto.Hosting.AspNetCore.Tests.csproj +++ b/test/Hosuto.Hosting.AspNetCore.Tests/Hosuto.Hosting.AspNetCore.Tests.csproj @@ -1,36 +1,36 @@  - netcoreapp3.1;net5.0;net6.0 + net6.0;net7.0;net8.0 false false - + - + - + - + - + - + - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/Hosuto.Hosting.Tests/Hosuto.Hosting.Tests.csproj b/test/Hosuto.Hosting.Tests/Hosuto.Hosting.Tests.csproj index eab8d58..694b97f 100644 --- a/test/Hosuto.Hosting.Tests/Hosuto.Hosting.Tests.csproj +++ b/test/Hosuto.Hosting.Tests/Hosuto.Hosting.Tests.csproj @@ -1,28 +1,20 @@  - netcoreapp3.0;net5.0;net6.0 + net6.0;net7.0;net8.0 false false - - - - - - - - - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/Hosuto.SimpleInjector.Tests/Hosuto.SimpleInjector.Tests.csproj b/test/Hosuto.SimpleInjector.Tests/Hosuto.SimpleInjector.Tests.csproj index e399ecd..8f75cad 100644 --- a/test/Hosuto.SimpleInjector.Tests/Hosuto.SimpleInjector.Tests.csproj +++ b/test/Hosuto.SimpleInjector.Tests/Hosuto.SimpleInjector.Tests.csproj @@ -1,32 +1,32 @@  - netcoreapp3.1;net5.0;net6.0 + net6.0;net7.0;net8.0 false false - + - + - + - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive