diff --git a/docs/en/UI/AspNetCore/Testing.md b/docs/en/UI/AspNetCore/Testing.md
index 2c880594d30..6efc967cb02 100644
--- a/docs/en/UI/AspNetCore/Testing.md
+++ b/docs/en/UI/AspNetCore/Testing.md
@@ -198,23 +198,10 @@ ABP Framework doesn't provide any infrastructure to test your JavaScript code. Y
> Volo.Abp.AspNetCore.TestBase package is already installed in the `.Web.Tests` project.
-This package provides the `AbpAspNetCoreIntegratedTestBase` as the fundamental base class to derive the test classes from. The `MyProjectWebTestBase` base class used above inherits from the `AbpAspNetCoreIntegratedTestBase`, so we indirectly inherited the `AbpAspNetCoreIntegratedTestBase`.
+This package provides the `AbpWebApplicationFactoryIntegratedTest` as the fundamental base class to derive the test classes from. It's inherited from the [WebApplicationFactory](https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests) class provided by the ASP.NET Core.
-### Base Properties
-
-The `AbpAspNetCoreIntegratedTestBase` provides the following base properties those are used in the tests:
-
-* `Server`: A `TestServer` instance that hosts the web application in tests.
-* `Client`: An `HttpClient` instance that is configured to perform requests to the test server.
-* `ServiceProvider`: The service provider that you can resolve services in case of need.
-
-### Base Methods
-
-`AbpAspNetCoreIntegratedTestBase` provides the following methods that you can override if you need to customize the test server:
-
-* `ConfigureServices` can be overridden to register/replace services only for the derived test class.
-* `CreateHostBuilder` can be used to customize building the `IHostBuilder`.
+The `MyProjectWebTestBase` base class used above inherits from the `AbpWebApplicationFactoryIntegratedTest`, so we indirectly inherited the `AbpWebApplicationFactoryIntegratedTest`.
See Also
-
+* [Integration tests in ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests)
* [Overall / Server Side Testing](../../Testing.md)
\ No newline at end of file
diff --git a/docs/zh-Hans/UI/AspNetCore/Testing.md b/docs/zh-Hans/UI/AspNetCore/Testing.md
index e5b09353fbe..1dfdbe367eb 100644
--- a/docs/zh-Hans/UI/AspNetCore/Testing.md
+++ b/docs/zh-Hans/UI/AspNetCore/Testing.md
@@ -198,23 +198,10 @@ ABP框架不提供任何基础设施来测试JavaScript代码. 你可以使用
> Volo.Abp.AspNetCore.TestBase 已经安装在 `.Web.Tests` 项目中.
-此包提供的`AbpAspNetCoreIntegratedTestBase`作为派生测试类的基类. 上面使用的`MyProjectWebTestBase`继承自`AbpAspNetCoreIntegratedTestBase`, 因此我们间接继承了`AbpAspNetCoreIntegratedTestBase`.
-
-### 基本属性
-
-`AbpAspNetCoreIntegratedTestBase` 提供了测试中使用的以下基本属性:
-
-* `Server`: 在测试中托管web应用程序的`TestServer`实例.
-* `Client`: 为执行对测试服务器的请求配置`HttpClient`实例.
-* `ServiceProvider`: 可以在你需要时处理服务提供服务.
-
-### 基本方法
-
-`AbpAspNetCoreIntegratedTestBase` 提供了以下方法, 如果需要自定义测试服务器, 可以重写这些方法:
-
-* `ConfigureServices` 仅为派生测试类注册/替换服务时可以重写使用.
-* `CreateHostBuilder` 可用于自定义生成 `IHostBuilder`.
+此包提供的`AbpWebApplicationFactoryIntegratedTest`作为派生测试类的基类. 它继承自ASP.NET Core提供的[WebApplicationFactory](https://learn.microsoft.com/zh-cn/aspnet/core/test/integration-tests)类。
+上面使用的`MyProjectWebTestBase`继承自`AbpWebApplicationFactoryIntegratedTest`, 因此我们间接继承了`AbpWebApplicationFactoryIntegratedTest`.
另请参阅
+* [ASP.NET Core 中的集成测试](https://learn.microsoft.com/zh-cn/aspnet/core/test/integration-tests)
* [总览/服务器端测试](../../Testing.md)
diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj
index a6f6a55f397..5bf1cc54aa2 100644
--- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj
@@ -28,6 +28,7 @@
+
diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreAsyncIntegratedTestBase.cs b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreAsyncIntegratedTestBase.cs
index 88926233645..e6c49d475c4 100644
--- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreAsyncIntegratedTestBase.cs
+++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreAsyncIntegratedTestBase.cs
@@ -13,6 +13,7 @@
namespace Volo.Abp.AspNetCore.TestBase;
+[Obsolete("Use AbpWebApplicationFactoryIntegratedTest instead.")]
public class AbpAspNetCoreAsyncIntegratedTestBase
where TModule : IAbpModule
{
diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs
index c362d5074c1..731b21ea03c 100644
--- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs
+++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs
@@ -14,6 +14,7 @@ namespace Volo.Abp.AspNetCore.TestBase;
///
/// Can be a module type or old-style ASP.NET Core Startup class.
///
+[Obsolete("Use AbpWebApplicationFactoryIntegratedTest instead.")]
public abstract class AbpAspNetCoreIntegratedTestBase : AbpTestBaseWithServiceProvider, IDisposable
where TStartupModule : class
{
@@ -51,7 +52,7 @@ protected virtual IHostBuilder CreateHostBuilder()
{
webBuilder.UseStartup();
}
-
+
webBuilder.UseAbpTestServer();
})
.UseAutofac()
diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpWebApplicationFactoryIntegratedTest.cs b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpWebApplicationFactoryIntegratedTest.cs
new file mode 100644
index 00000000000..c7b5f48ebec
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpWebApplicationFactoryIntegratedTest.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using Microsoft.AspNetCore.Mvc.Testing;
+using Microsoft.AspNetCore.Routing;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+
+namespace Volo.Abp.AspNetCore.TestBase;
+
+public abstract class AbpWebApplicationFactoryIntegratedTest : WebApplicationFactory
+ where TProgram : class
+{
+ protected HttpClient Client { get; set; }
+
+ protected IServiceProvider ServiceProvider => Services;
+
+ protected AbpWebApplicationFactoryIntegratedTest()
+ {
+ Client = CreateClient(new WebApplicationFactoryClientOptions
+ {
+ AllowAutoRedirect = false
+ });
+ ServiceProvider.GetRequiredService().Server = Server;
+ }
+
+ protected override IHost CreateHost(IHostBuilder builder)
+ {
+ builder.ConfigureServices(ConfigureServices);
+ return base.CreateHost(builder);
+ }
+
+ protected virtual T? GetService()
+ {
+ return Services.GetService();
+ }
+
+ protected virtual T GetRequiredService() where T : notnull
+ {
+ return Services.GetRequiredService();
+ }
+
+ protected virtual void ConfigureServices(IServiceCollection services)
+ {
+
+ }
+
+ #region GetUrl
+
+ ///
+ /// Gets default URL for given controller type.
+ ///
+ /// The type of the controller.
+ protected virtual string GetUrl()
+ {
+ return "/" + typeof(TController).Name.RemovePostFix("Controller", "AppService", "ApplicationService", "IntService", "IntegrationService", "Service");
+ }
+
+ ///
+ /// Gets default URL for given controller type's given action.
+ ///
+ /// The type of the controller.
+ protected virtual string GetUrl(string actionName)
+ {
+ return GetUrl() + "/" + actionName;
+ }
+
+ ///
+ /// Gets default URL for given controller type's given action with query string parameters (as anonymous object).
+ ///
+ /// The type of the controller.
+ protected virtual string GetUrl(string actionName, object queryStringParamsAsAnonymousObject)
+ {
+ var url = GetUrl(actionName);
+
+ var dictionary = new RouteValueDictionary(queryStringParamsAsAnonymousObject);
+ if (dictionary.Any())
+ {
+ url += "?" + dictionary.Select(d => $"{d.Key}={d.Value}").JoinAsString("&");
+ }
+
+ return url;
+ }
+
+ #endregion
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/WebApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/WebApplicationBuilderExtensions.cs
new file mode 100644
index 00000000000..403bbac7b15
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/WebApplicationBuilderExtensions.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using Volo.Abp.Modularity;
+
+namespace Volo.Abp.AspNetCore.TestBase;
+
+public static class WebApplicationBuilderExtensions
+{
+ public async static Task RunAbpModuleAsync(this WebApplicationBuilder builder, Action? optionsAction = null)
+ where TModule : IAbpModule
+ {
+ var assemblyName = typeof(TModule).Assembly.GetName()?.Name;
+ if (!assemblyName.IsNullOrWhiteSpace())
+ {
+ // Set the application name as the assembly name of the module will automatically add assembly to the ApplicationParts of MVC application.
+ builder.Environment.ApplicationName = assemblyName!;
+ }
+ builder.Host.UseAutofac();
+ await builder.AddApplicationAsync(optionsAction);
+ var app = builder.Build();
+ await app.InitializeApplicationAsync();
+ await app.RunAsync();
+ }
+}
diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/Program.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/Program.cs
new file mode 100644
index 00000000000..d2e28ce2c18
--- /dev/null
+++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/Program.cs
@@ -0,0 +1,11 @@
+using Microsoft.AspNetCore.Builder;
+using Volo.Abp.AspNetCore;
+using Volo.Abp.AspNetCore.App;
+using Volo.Abp.AspNetCore.TestBase;
+
+var builder = WebApplication.CreateBuilder();
+await builder.RunAbpModuleAsync();
+
+public partial class Program
+{
+}
diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/Startup.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/Startup.cs
deleted file mode 100644
index 46981d27bed..00000000000
--- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/Startup.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-
-namespace Volo.Abp.AspNetCore.App;
-
-public class Startup
-{
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddApplication();
- }
-
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
- {
- app.InitializeApplication();
- }
-}
diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancyTestBase.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancyTestBase.cs
index 15991117f4f..7ff1acc7a5e 100644
--- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancyTestBase.cs
+++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancyTestBase.cs
@@ -1,7 +1,7 @@
namespace Volo.Abp.AspNetCore.MultiTenancy;
-public abstract class AspNetCoreMultiTenancyTestBase : AbpAspNetCoreTestBase
+public abstract class AspNetCoreMultiTenancyTestBase : AbpAspNetCoreTestBase
{
}
diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs
index a630df49866..e80b47b2a5d 100644
--- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs
@@ -24,23 +24,22 @@ public AspNetCoreMultiTenancy_WithDomainResolver_Tests()
_options = ServiceProvider.GetRequiredService>().Value;
}
- protected override IHostBuilder CreateHostBuilder()
+ protected override void ConfigureServices(IServiceCollection services)
{
- return base.CreateHostBuilder().ConfigureServices(services =>
+ services.Configure(options =>
{
- services.Configure(options =>
+ options.Tenants = new[]
{
- options.Tenants = new[]
- {
- new TenantConfiguration(_testTenantId, _testTenantName)
- };
- });
+ new TenantConfiguration(_testTenantId, _testTenantName)
+ };
+ });
- services.Configure(options =>
- {
- options.AddDomainTenantResolver("{0}.abp.io:8080");
- });
+ services.Configure(options =>
+ {
+ options.AddDomainTenantResolver("{0}.abp.io:8080");
});
+
+ base.ConfigureServices(services);
}
[Fact]
diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs
index ccbd941bae0..56da287ef8d 100644
--- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs
@@ -25,18 +25,17 @@ public AspNetCoreMultiTenancy_Without_DomainResolver_Tests()
_options = ServiceProvider.GetRequiredService>().Value;
}
- protected override IHostBuilder CreateHostBuilder()
+ protected override void ConfigureServices(IServiceCollection services)
{
- return base.CreateHostBuilder().ConfigureServices(services =>
+ services.Configure(options =>
{
- services.Configure(options =>
+ options.Tenants = new[]
{
- options.Tenants = new[]
- {
- new TenantConfiguration(_testTenantId, _testTenantName)
- };
- });
+ new TenantConfiguration(_testTenantId, _testTenantName)
+ };
});
+
+ base.ConfigureServices(services);
}
[Fact]
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AspNetCoreMvcTestBase.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AspNetCoreMvcTestBase.cs
index 6acbb772429..d1e02f8ebcb 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AspNetCoreMvcTestBase.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AspNetCoreMvcTestBase.cs
@@ -1,41 +1,6 @@
-using System.IO;
-using System.Linq;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Hosting;
-
namespace Volo.Abp.AspNetCore.Mvc;
-public abstract class AspNetCoreMvcTestBase : AbpAspNetCoreTestBase
+public abstract class AspNetCoreMvcTestBase : AbpAspNetCoreTestBase
{
- protected override IHostBuilder CreateHostBuilder()
- {
- var contentRootPath = CalculateContentRootPath(
- "Volo.Abp.AspNetCore.Mvc.Tests.csproj",
- string.Format(
- "Volo{0}Abp{0}AspNetCore{0}App",
- Path.DirectorySeparatorChar
- )
- );
-
- return base.CreateHostBuilder()
- .UseContentRoot(contentRootPath);
- }
-
- private static string CalculateContentRootPath(string projectFileName, string contentPath)
- {
- var currentDirectory = Directory.GetCurrentDirectory();
- while (!ContainsFile(currentDirectory, projectFileName))
- {
- currentDirectory = new DirectoryInfo(currentDirectory).Parent.FullName;
- }
-
- return Path.Combine(currentDirectory, contentPath);
- }
- private static bool ContainsFile(string currentDirectory, string projectFileName)
- {
- return Directory
- .GetFiles(currentDirectory, "*.*", SearchOption.TopDirectoryOnly)
- .Any(f => Path.GetFileName(f) == projectFileName);
- }
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditIntegrationServiceTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditIntegrationServiceTestController_Tests.cs
index 129035f406f..74677b27c47 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditIntegrationServiceTestController_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditIntegrationServiceTestController_Tests.cs
@@ -22,11 +22,11 @@ public AuditIntegrationServiceTestController_Tests()
_auditingStore = ServiceProvider.GetRequiredService();
}
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
_auditingStore = Substitute.For();
services.Replace(ServiceDescriptor.Singleton(_auditingStore));
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
}
[Fact]
@@ -55,4 +55,4 @@ public async Task Should_Not_Write_Audit_Log_For_Controllers_With_IntegrationSer
await GetResponseAsync("/integration-api/audit-test/");
await _auditingStore.DidNotReceive().SaveAsync(Arg.Any());
}
-}
\ No newline at end of file
+}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController_Tests.cs
index 78d537e252e..2a4ee0a8f2b 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController_Tests.cs
@@ -23,11 +23,11 @@ public AuditTestController_Tests()
_auditingStore = ServiceProvider.GetRequiredService();
}
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
_auditingStore = Substitute.For();
services.Replace(ServiceDescriptor.Singleton(_auditingStore));
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
}
[Fact]
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestPage_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestPage_Tests.cs
index aae671d6d47..37586694571 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestPage_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestPage_Tests.cs
@@ -22,11 +22,11 @@ public AuditTestPage_Tests()
_auditingStore = ServiceProvider.GetRequiredService();
}
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
_auditingStore = Substitute.For();
services.Replace(ServiceDescriptor.Singleton(_auditingStore));
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
}
[Fact]
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Controllers/ReplaceBuiltInController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Controllers/ReplaceBuiltInController_Tests.cs
index 46aa0369e3d..7060a91b995 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Controllers/ReplaceBuiltInController_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Controllers/ReplaceBuiltInController_Tests.cs
@@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Controllers;
public class ReplaceBuiltInController_Tests : AspNetCoreMvcTestBase
{
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
services.Configure(options =>
{
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpAuthorizationExceptionTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpAuthorizationExceptionTestController_Tests.cs
index e8e49b49466..95e6b5ca47b 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpAuthorizationExceptionTestController_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpAuthorizationExceptionTestController_Tests.cs
@@ -24,9 +24,9 @@ public AbpAuthorizationExceptionTestController_Tests()
FakeRequiredService = GetRequiredService();
}
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
FakeExceptionSubscriber = Substitute.For();
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpAuthorizationExceptionTestPage_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpAuthorizationExceptionTestPage_Tests.cs
index 689f3a00dca..0b10ff91da7 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpAuthorizationExceptionTestPage_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpAuthorizationExceptionTestPage_Tests.cs
@@ -24,9 +24,9 @@ public AbpAuthorizationExceptionTestPage_Tests()
_fakeRequiredService = GetRequiredService();
}
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
_fakeExceptionSubscriber = Substitute.For();
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestController_Tests.cs
index 2f10f4b0279..1b79441de89 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestController_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestController_Tests.cs
@@ -26,9 +26,9 @@ public ExceptionTestController_Tests()
FakeRequiredService = GetRequiredService();
}
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
_fakeExceptionSubscriber = Substitute.For();
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestPage_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestPage_Tests.cs
index 3290b37c957..48ccf6499ff 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestPage_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestPage_Tests.cs
@@ -26,9 +26,9 @@ public ExceptionTestPage_Tests()
_fakeRequiredService = GetRequiredService();
}
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
_fakeExceptionSubscriber = Substitute.For();
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonResultController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonResultController_Tests.cs
index e7015313cb0..23c16677e20 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonResultController_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonResultController_Tests.cs
@@ -10,14 +10,14 @@ namespace Volo.Abp.AspNetCore.Mvc.Json;
public class JsonResultController_Tests : AspNetCoreMvcTestBase
{
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
services.Configure(options =>
{
options.OutputDateTimeFormat = "yyyy*MM*dd";
});
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
}
[Fact]
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonSerializer_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonSerializer_Tests.cs
index 1613e4bb49f..d0888a0fdf2 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonSerializer_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonSerializer_Tests.cs
@@ -17,14 +17,14 @@ public JsonSerializer_Tests()
_jsonSerializer = ServiceProvider.GetRequiredService();
}
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
services.Configure(options =>
{
options.OutputDateTimeFormat = "yyyy*MM*dd";
});
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
}
[Fact]
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/LocalizationTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/LocalizationTestController_Tests.cs
index b575b4ce78f..d23a5c1a9fe 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/LocalizationTestController_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/LocalizationTestController_Tests.cs
@@ -21,7 +21,7 @@ public override Task DetermineProviderCultureResult(HttpC
}
}
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
services.Configure(options =>
{
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs
index 53bfff8b687..973e2f7192c 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs
@@ -122,22 +122,22 @@ public async Task Guid_Json_Test()
public class ModelBindingController_Utc_Tests : ModelBindingController_Tests
{
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
Kind = DateTimeKind.Utc;
services.Configure(x => x.Kind = Kind);
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
}
}
public class ModelBindingController_Local_Tests : ModelBindingController_Tests
{
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
Kind = DateTimeKind.Local;
services.Configure(x => x.Kind = Kind);
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
}
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Program.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Program.cs
new file mode 100644
index 00000000000..9e1bf5e51c6
--- /dev/null
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Program.cs
@@ -0,0 +1,49 @@
+using System;
+using System.IO;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp;
+using Volo.Abp.AspNetCore;
+using Volo.Abp.AspNetCore.Mvc;
+using Volo.Abp.AspNetCore.TestBase;
+using Volo.Abp.Modularity.PlugIns;
+
+var builder = WebApplication.CreateBuilder();
+await builder.RunAbpModuleAsync(options =>
+{
+ var hostEnvironment = options.Services.GetHostingEnvironment();
+ var currentDirectory = hostEnvironment.ContentRootPath;
+ var plugDllInPath = "";
+
+ for (var i = 0; i < 10; i++)
+ {
+ var parentDirectory = new DirectoryInfo(currentDirectory).Parent;
+ if (parentDirectory == null)
+ {
+ break;
+ }
+
+ if (parentDirectory.Name == "test")
+ {
+#if DEBUG
+ plugDllInPath = Path.Combine(parentDirectory.FullName, "Volo.Abp.AspNetCore.Mvc.PlugIn", "bin", "Debug", "net7.0");
+#else
+ plugDllInPath = Path.Combine(parentDirectory.FullName, "Volo.Abp.AspNetCore.Mvc.PlugIn", "bin", "Release", "net7.0");
+#endif
+ break;
+ }
+
+ currentDirectory = parentDirectory.FullName;
+ }
+
+ if (plugDllInPath.IsNullOrWhiteSpace())
+ {
+ throw new AbpException("Could not find the plug DLL path!");
+ }
+
+ options.PlugInSources.AddFolder(plugDllInPath);
+});
+
+public partial class Program
+{
+}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Security/Headers/SecurityHeadersTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Security/Headers/SecurityHeadersTestController_Tests.cs
index 4c419ef744f..dab4a034660 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Security/Headers/SecurityHeadersTestController_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Security/Headers/SecurityHeadersTestController_Tests.cs
@@ -10,7 +10,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Security.Headers;
public class SecurityHeadersTestController_Tests : AspNetCoreMvcTestBase
{
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
services.Configure(options =>
{
@@ -18,7 +18,7 @@ protected override void ConfigureServices(HostBuilderContext context, IServiceCo
options.Headers["Referrer-Policy"] = "no-referrer";
});
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
}
[Fact]
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Startup.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Startup.cs
deleted file mode 100644
index df5a8b7b9c3..00000000000
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Startup.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System;
-using System.IO;
-using System.Linq;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-using Volo.Abp.Modularity.PlugIns;
-
-namespace Volo.Abp.AspNetCore.Mvc;
-
-public class Startup
-{
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddApplication(options =>
- {
- var hostEnvironment = services.GetHostingEnvironment();
- var currentDirectory = hostEnvironment.ContentRootPath;
- var plugDllInPath = "";
-
- for (var i = 0; i < 10; i++)
- {
- var parentDirectory = new DirectoryInfo(currentDirectory).Parent;
- if (parentDirectory == null)
- {
- break;
- }
-
- if (parentDirectory.Name == "test")
- {
-#if DEBUG
- plugDllInPath = Path.Combine(parentDirectory.FullName, "Volo.Abp.AspNetCore.Mvc.PlugIn", "bin", "Debug", "net7.0");
-#else
- plugDllInPath = Path.Combine(parentDirectory.FullName, "Volo.Abp.AspNetCore.Mvc.PlugIn", "bin", "Release", "net7.0");
-#endif
- break;
- }
-
- currentDirectory = parentDirectory.FullName;
- }
-
- if (plugDllInPath.IsNullOrWhiteSpace())
- {
- throw new AbpException("Could not find the plug DLL path!");
- }
-
- options.PlugInSources.AddFolder(plugDllInPath);
- });
- }
-
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
- {
- app.InitializeApplication();
- }
-}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Exception_Rollback_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Exception_Rollback_Tests.cs
index 068accad6a5..7c0658638d5 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Exception_Rollback_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Exception_Rollback_Tests.cs
@@ -14,7 +14,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow;
public class UnitOfWorkMiddleware_Exception_Rollback_Tests : AspNetCoreMvcTestBase
{
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
services.Replace(ServiceDescriptor.Transient());
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkPageFilter_Exception_Rollback_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkPageFilter_Exception_Rollback_Tests.cs
index f5e3bf2123f..652c9362766 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkPageFilter_Exception_Rollback_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkPageFilter_Exception_Rollback_Tests.cs
@@ -14,7 +14,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow;
public class UnitOfWorkPageFilter_Exception_Rollback_Tests : AspNetCoreMvcTestBase
{
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
services.Replace(ServiceDescriptor.Transient());
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs
index 588c130a22d..ab0fd586b31 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs
@@ -118,14 +118,14 @@ public async Task SubClass_Should_Disable_Validate_If_Action_Has_DisableValidati
public class DisableAutoModelValidationTestController_Tests : AspNetCoreMvcTestBase
{
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
services.Configure(options =>
{
options.AutoModelValidation = false;
});
- base.ConfigureServices(context, services);
+ base.ConfigureServices(services);
}
[Fact]
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo/Abp/AspNetCore/Mvc/UI/AbpAspNetCoreMvcUiTestBase.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo/Abp/AspNetCore/Mvc/UI/AbpAspNetCoreMvcUiTestBase.cs
index 99ca4da729d..43167ce47d6 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo/Abp/AspNetCore/Mvc/UI/AbpAspNetCoreMvcUiTestBase.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo/Abp/AspNetCore/Mvc/UI/AbpAspNetCoreMvcUiTestBase.cs
@@ -1,8 +1,6 @@
-using Volo.Abp.AspNetCore.TestBase;
+namespace Volo.Abp.AspNetCore.Mvc.UI;
-namespace Volo.Abp.AspNetCore.Mvc.UI;
-
-public abstract class AbpAspNetCoreMvcUiTestBase : AbpAspNetCoreIntegratedTestBase
+public abstract class AbpAspNetCoreMvcUiTestBase : AbpAspNetCoreTestBase
{
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo/Abp/AspNetCore/Mvc/UI/Program.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo/Abp/AspNetCore/Mvc/UI/Program.cs
new file mode 100644
index 00000000000..bd6027c6243
--- /dev/null
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo/Abp/AspNetCore/Mvc/UI/Program.cs
@@ -0,0 +1,11 @@
+using Microsoft.AspNetCore.Builder;
+using Volo.Abp.AspNetCore;
+using Volo.Abp.AspNetCore.Mvc.UI;
+using Volo.Abp.AspNetCore.TestBase;
+
+var builder = WebApplication.CreateBuilder();
+await builder.RunAbpModuleAsync();
+
+public partial class Program
+{
+}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo/Abp/AspNetCore/Mvc/UI/Startup.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo/Abp/AspNetCore/Mvc/UI/Startup.cs
deleted file mode 100644
index 0e1954b6309..00000000000
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo/Abp/AspNetCore/Mvc/UI/Startup.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-
-namespace Volo.Abp.AspNetCore.Mvc.UI;
-
-public class Startup
-{
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddApplication();
- }
-
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
- {
- app.InitializeApplication();
- }
-}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Program.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Program.cs
index 3f2eaedeb01..b7c7d4cd343 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Program.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Program.cs
@@ -1,25 +1,11 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Logging;
+using Microsoft.AspNetCore.Builder;
+using Volo.Abp.AspNetCore;
+using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests.Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
+using Volo.Abp.AspNetCore.TestBase;
-namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests;
+var builder = WebApplication.CreateBuilder();
+await builder.RunAbpModuleAsync();
-public class Program
+public partial class Program
{
- public static void Main(string[] args)
- {
- CreateHostBuilder(args).Build().Run();
- }
-
- public static IHostBuilder CreateHostBuilder(string[] args) =>
- Host.CreateDefaultBuilder(args)
- .ConfigureWebHostDefaults(webBuilder =>
- {
- webBuilder.UseStartup();
- });
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/AbpAspNetCoreMvcUiThemeSharedTestBase.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/AbpAspNetCoreMvcUiThemeSharedTestBase.cs
index b450dd97d25..1f7f5f2a82d 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/AbpAspNetCoreMvcUiThemeSharedTestBase.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/AbpAspNetCoreMvcUiThemeSharedTestBase.cs
@@ -1,5 +1,5 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests.Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
-public class AbpAspNetCoreMvcUiThemeSharedTestBase : AbpAspNetCoreTestBase
+public class AbpAspNetCoreMvcUiThemeSharedTestBase : AbpAspNetCoreTestBase
{
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/AbpAspNetCoreMvcUiThemeSharedTestModule.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/AbpAspNetCoreMvcUiThemeSharedTestModule.cs
index bfc1303970f..a665d2c49dd 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/AbpAspNetCoreMvcUiThemeSharedTestModule.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/AbpAspNetCoreMvcUiThemeSharedTestModule.cs
@@ -11,8 +11,5 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests.Volo.Abp.AspNetCore.Mvc.
)]
public class AbpAspNetCoreMvcUiThemeSharedTestModule : AbpModule
{
- public override void ConfigureServices(ServiceConfigurationContext context)
- {
- }
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/PageToolbars/PageToolbar_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/PageToolbars/PageToolbar_Tests.cs
index 4bd8c2d036d..cab4ca631c6 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/PageToolbars/PageToolbar_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/PageToolbars/PageToolbar_Tests.cs
@@ -13,7 +13,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests.Volo.Abp.AspNetCore.Mvc.
public class PageToolbar_Tests : AbpAspNetCoreMvcUiThemeSharedTestBase
{
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
services.Configure(options =>
{
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/Startup.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/Startup.cs
deleted file mode 100644
index d17ee6203b3..00000000000
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/Startup.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.Extensions.Logging;
-
-namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests.Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
-
-public class Startup
-{
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddApplication();
- }
-
- public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
- {
- app.InitializeApplication();
- }
-}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/Toolbars/Toolbar_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/Toolbars/Toolbar_Tests.cs
index d9e5be8b2d2..2c5394a9318 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/Toolbars/Toolbar_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests/Volo/Abp/AspNetCore/Mvc/UI/Theme/Shared/Toolbars/Toolbar_Tests.cs
@@ -19,7 +19,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests.Volo.Abp.AspNetCore.Mvc.
public class Toolbar_Tests : AbpAspNetCoreMvcUiThemeSharedTestBase
{
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
services.Configure(options =>
{
@@ -35,7 +35,7 @@ protected override void ConfigureServices(HostBuilderContext context, IServiceCo
var claimsPrincipal = new ClaimsPrincipal(identity);
var principalAccessor = Substitute.For();
principalAccessor.Principal.Returns(ci => claimsPrincipal);
- Thread.CurrentPrincipal = claimsPrincipal;
+ services.Replace(ServiceDescriptor.Singleton(principalAccessor));
var themeManager = Substitute.For();
themeManager.CurrentTheme.Returns(x => null);
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AspNetCoreMvcVersioningTestBase.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AspNetCoreMvcVersioningTestBase.cs
index 0df183aca16..5792517562d 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AspNetCoreMvcVersioningTestBase.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AspNetCoreMvcVersioningTestBase.cs
@@ -1,5 +1,5 @@
namespace Volo.Abp.AspNetCore.Mvc.Versioning;
-public abstract class AspNetCoreMvcVersioningTestBase : AbpAspNetCoreTestBase
+public abstract class AspNetCoreMvcVersioningTestBase : AbpAspNetCoreTestBase
{
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Program.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Program.cs
new file mode 100644
index 00000000000..3d85fb71f9e
--- /dev/null
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Program.cs
@@ -0,0 +1,11 @@
+using Microsoft.AspNetCore.Builder;
+using Volo.Abp.AspNetCore;
+using Volo.Abp.AspNetCore.Mvc.Versioning;
+using Volo.Abp.AspNetCore.TestBase;
+
+var builder = WebApplication.CreateBuilder();
+await builder.RunAbpModuleAsync();
+
+public partial class Program
+{
+}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Startup.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Startup.cs
deleted file mode 100644
index 4ccb18feace..00000000000
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Startup.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-
-namespace Volo.Abp.AspNetCore.Mvc.Versioning;
-
-public class Startup
-{
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddApplication();
- }
-
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
- {
- app.InitializeApplication();
- }
-}
diff --git a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/Program.cs b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/Program.cs
new file mode 100644
index 00000000000..dbbce46a5e8
--- /dev/null
+++ b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/Program.cs
@@ -0,0 +1,11 @@
+using Microsoft.AspNetCore.Builder;
+using Volo.Abp.AspNetCore;
+using Volo.Abp.AspNetCore.App;
+using Volo.Abp.AspNetCore.TestBase;
+
+var builder = WebApplication.CreateBuilder();
+await builder.RunAbpModuleAsync();
+
+public partial class Program
+{
+}
diff --git a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/Startup.cs b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/Startup.cs
deleted file mode 100644
index 8464f6e77be..00000000000
--- a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/Startup.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-
-namespace Volo.Abp.AspNetCore.App;
-
-public class Startup
-{
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddApplication();
- }
-
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
- {
- app.InitializeApplication();
- }
-}
diff --git a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/AbpSerilogTestBase.cs b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/AbpSerilogTestBase.cs
index acfb7e54d06..acf053ced75 100644
--- a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/AbpSerilogTestBase.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/AbpSerilogTestBase.cs
@@ -6,11 +6,11 @@
namespace Volo.Abp.AspNetCore.Serilog;
-public class AbpSerilogTestBase : AbpAspNetCoreTestBase
+public class AbpSerilogTestBase : AbpAspNetCoreTestBase
{
protected readonly CollectingSink CollectingSink = new CollectingSink();
- protected override IHostBuilder CreateHostBuilder()
+ protected override IHost CreateHost(IHostBuilder builder)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
@@ -19,8 +19,8 @@ protected override IHostBuilder CreateHostBuilder()
.WriteTo.Sink(CollectingSink)
.CreateLogger();
- return base.CreateHostBuilder()
- .UseSerilog();
+ builder.UseSerilog();
+ return base.CreateHost(builder);;
}
protected LogEvent GetLogEvent(string text)
diff --git a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/Serilog_Enrichers_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/Serilog_Enrichers_Tests.cs
index b8f197d3c13..4782a5e7688 100644
--- a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/Serilog_Enrichers_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/Serilog_Enrichers_Tests.cs
@@ -33,18 +33,16 @@ public Serilog_Enrichers_Tests()
_logger = ServiceProvider.GetRequiredService>();
}
- protected override IHostBuilder CreateHostBuilder()
+ protected override void ConfigureServices(IServiceCollection services)
{
- return base.CreateHostBuilder().ConfigureServices(services =>
+ services.Configure(options =>
{
- services.Configure(options =>
+ options.Tenants = new[]
{
- options.Tenants = new[]
- {
- new TenantConfiguration(_testTenantId, _testTenantName)
- };
- });
+ new TenantConfiguration(_testTenantId, _testTenantName)
+ };
});
+ base.ConfigureServices(services);
}
[Fact]
diff --git a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpAspNetCoreTestBase.cs b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpAspNetCoreTestBase.cs
index a79c4998e8d..f78f27f141c 100644
--- a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpAspNetCoreTestBase.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpAspNetCoreTestBase.cs
@@ -9,13 +9,12 @@
namespace Volo.Abp.AspNetCore;
-public class AbpAspNetCoreTestBase : AbpAspNetCoreTestBase
+public class AbpAspNetCoreTestBase : AbpAspNetCoreTestBase
{
-
}
-public abstract class AbpAspNetCoreTestBase : AbpAspNetCoreIntegratedTestBase
- where TStartup : class
+public abstract class AbpAspNetCoreTestBase : AbpWebApplicationFactoryIntegratedTest
+ where TProgram : class
{
protected virtual async Task GetResponseAsObjectAsync(string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK)
{
diff --git a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpHostEnvironment_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpHostEnvironment_Tests.cs
index 16799162bbe..a87772536bb 100644
--- a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpHostEnvironment_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpHostEnvironment_Tests.cs
@@ -1,7 +1,5 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
+using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
-using Microsoft.Extensions.Configuration.Memory;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Shouldly;
@@ -9,22 +7,8 @@
namespace Volo.Abp.AspNetCore;
-public class AbpHostEnvironment_Tests : AbpAspNetCoreTestBase
+public class AbpHostEnvironment_Tests : AbpAspNetCoreTestBase
{
- protected override IHostBuilder CreateHostBuilder()
- {
- var builder = base.CreateHostBuilder();
- builder.ConfigureHostConfiguration(x => x.Sources.Insert(0,
- new MemoryConfigurationSource()
- {
- InitialData = new List>
- {
- new(HostDefaults.EnvironmentKey, Environments.Staging),
- }
- }));
- return builder;
- }
-
[Fact]
public void Should_Set_Environment_From_IWebHostEnvironment()
{
diff --git a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/Program.cs b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/Program.cs
new file mode 100644
index 00000000000..841b2903c2c
--- /dev/null
+++ b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/Program.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.Hosting;
+using Volo.Abp.AspNetCore;
+using Volo.Abp.AspNetCore.TestBase;
+
+var builder = WebApplication.CreateBuilder(new WebApplicationOptions
+{
+ EnvironmentName = Environments.Staging
+});
+await builder.RunAbpModuleAsync();
+
+public partial class Program
+{
+}
diff --git a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/Startup.cs b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/Startup.cs
deleted file mode 100644
index 133b77fcc82..00000000000
--- a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/Startup.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-
-namespace Volo.Abp.AspNetCore;
-
-public class Startup
-{
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddApplication();
- }
-
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
- {
- app.InitializeApplication();
- }
-}
diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/AbpHttpClientTestBase.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/AbpHttpClientTestBase.cs
index 9ae4370b381..dfa5c335b20 100644
--- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/AbpHttpClientTestBase.cs
+++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/AbpHttpClientTestBase.cs
@@ -2,7 +2,7 @@
namespace Volo.Abp.Http;
-public abstract class AbpHttpClientTestBase : AbpAspNetCoreTestBase
+public abstract class AbpHttpClientTestBase : AbpAspNetCoreTestBase
{
}
diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/AbpHttpClientTestModule.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/AbpHttpClientTestModule.cs
index 6540b717d3a..5e9107a23be 100644
--- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/AbpHttpClientTestModule.cs
+++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/AbpHttpClientTestModule.cs
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc;
-using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Client.ClientProxying;
using Volo.Abp.Http.DynamicProxying;
diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestControllerClientProxy_AbpRemoteCallException_Tests.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestControllerClientProxy_AbpRemoteCallException_Tests.cs
index 8469ba121a9..f679ccd9c9c 100644
--- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestControllerClientProxy_AbpRemoteCallException_Tests.cs
+++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestControllerClientProxy_AbpRemoteCallException_Tests.cs
@@ -20,7 +20,7 @@ public RegularTestControllerClientProxy_AbpRemoteCallException_Tests()
_controller = ServiceProvider.GetRequiredService();
}
- protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services)
+ protected override void ConfigureServices(IServiceCollection services)
{
services.Replace(ServiceDescriptor.Singleton());
}
diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/Program.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/Program.cs
new file mode 100644
index 00000000000..a0cfe08f845
--- /dev/null
+++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/Program.cs
@@ -0,0 +1,11 @@
+using Microsoft.AspNetCore.Builder;
+using Volo.Abp.AspNetCore;
+using Volo.Abp.AspNetCore.TestBase;
+using Volo.Abp.Http;
+
+var builder = WebApplication.CreateBuilder();
+await builder.RunAbpModuleAsync();
+
+public partial class Program
+{
+}
diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/Startup.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/Startup.cs
deleted file mode 100644
index 063b9999c10..00000000000
--- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/Startup.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Volo.Abp.Http;
-
-public class Startup
-{
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddApplication();
- }
-
- public void Configure(IApplicationBuilder app)
- {
- app.InitializeApplication();
- }
-}
diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestBase.cs b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestBase.cs
index d038106f5a0..f6c290ef6d8 100644
--- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestBase.cs
+++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestBase.cs
@@ -1,23 +1,15 @@
-using System;
-using System.Net;
+using System.Net;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
-using Microsoft.Extensions.Hosting;
using Shouldly;
+using Volo.Abp.AspNetCore;
using Volo.Abp.AspNetCore.TestBase;
namespace MyCompanyName.MyProjectName;
-public abstract class MyProjectNameWebTestBase : AbpAspNetCoreIntegratedTestBase
+public abstract class MyProjectNameWebTestBase : AbpWebApplicationFactoryIntegratedTest
{
- protected override IHostBuilder CreateHostBuilder()
- {
- return base
- .CreateHostBuilder()
- .UseContentRoot(WebContentDirectoryFinder.CalculateContentRootFolder() ?? throw new InvalidOperationException());
- }
-
protected virtual async Task GetResponseAsObjectAsync(string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK)
{
var strResponse = await GetResponseAsStringAsync(url, expectedStatusCode);
diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/Program.cs b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/Program.cs
new file mode 100644
index 00000000000..f4c388685f1
--- /dev/null
+++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/Program.cs
@@ -0,0 +1,10 @@
+using Microsoft.AspNetCore.Builder;
+using MyCompanyName.MyProjectName;
+using Volo.Abp.AspNetCore.TestBase;
+
+var builder = WebApplication.CreateBuilder();
+await builder.RunAbpModuleAsync();
+
+public partial class Program
+{
+}