11using System ;
22using Kralizek . AutoFixture . Extensions . Internal ;
33using Microsoft . AspNetCore . Hosting ;
4+ using Microsoft . AspNetCore . Mvc . Testing ;
45// ReSharper disable CheckNamespace
56
67namespace AutoFixture
@@ -11,13 +12,27 @@ public static class AspNetCoreWebApplicationFactoryFixtureExtensions
1112
1213 public static IFixture AddWebApplicationFactorySupport < TEntryPoint > ( this IFixture fixture , Action < IWebHostBuilder > ? configuration = null )
1314 where TEntryPoint : class
15+ {
16+ return AddWebApplicationFactorySupport < WebApplicationFactory < TEntryPoint > , TEntryPoint > ( fixture , configuration ?? EmptyAction ) ;
17+ }
18+
19+ public static IFixture AddWebApplicationFactorySupport < TFactory , TEntryPoint > ( this IFixture fixture )
20+ where TFactory : WebApplicationFactory < TEntryPoint > , new ( )
21+ where TEntryPoint : class
22+ {
23+ return AddWebApplicationFactorySupport < TFactory , TEntryPoint > ( fixture , EmptyAction ) ;
24+ }
25+
26+ private static IFixture AddWebApplicationFactorySupport < TFactory , TEntryPoint > ( this IFixture fixture , Action < IWebHostBuilder > configuration )
27+ where TFactory : WebApplicationFactory < TEntryPoint > , new ( )
28+ where TEntryPoint : class
1429 {
1530 if ( fixture is null )
1631 {
1732 throw new ArgumentNullException ( nameof ( fixture ) ) ;
1833 }
1934
20- fixture . Customize ( new WebApplicationFactoryCustomization < TEntryPoint > ( configuration ?? EmptyAction ) ) ;
35+ fixture . Customize ( new WebApplicationFactoryCustomization < TFactory , TEntryPoint > ( configuration ) ) ;
2136
2237 return fixture ;
2338 }
0 commit comments