mirror of https://github.com/abpframework/abp.git
4 changed files with 85 additions and 3 deletions
@ -0,0 +1,18 @@ |
|||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.Hosting; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.TestBase; |
||||
|
|
||||
|
public class AbpNoopHostLifetime : IHostLifetime |
||||
|
{ |
||||
|
public Task StopAsync(CancellationToken cancellationToken) |
||||
|
{ |
||||
|
return Task.CompletedTask; |
||||
|
} |
||||
|
|
||||
|
public Task WaitForStartAsync(CancellationToken cancellationToken) |
||||
|
{ |
||||
|
return Task.CompletedTask; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using Microsoft.AspNetCore.Hosting; |
||||
|
using Microsoft.AspNetCore.Hosting.Server; |
||||
|
using Microsoft.AspNetCore.TestHost; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Microsoft.Extensions.Hosting; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.TestBase; |
||||
|
|
||||
|
public static class AbpWebHostBuilderExtensions |
||||
|
{ |
||||
|
public static IWebHostBuilder UseAbpTestServer(this IWebHostBuilder builder) |
||||
|
{ |
||||
|
return builder.ConfigureServices(services => |
||||
|
{ |
||||
|
services.AddScoped<IHostLifetime, AbpNoopHostLifetime>(); |
||||
|
services.AddScoped<IServer, TestServer>(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue