ExampleSignalR/TestProject/WebAppFactoryFixture.cs

22 lines
638 B
C#
Raw Permalink Normal View History

2024-11-13 15:38:13 +05:00
using ExampleSignalR.Test.Services;
2024-11-12 18:02:09 +05:00
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace ExampleSignalR.Test;
public class WebAppFactoryFixture : WebApplicationFactory<ExampleSignalR.Program>
{
protected override void ConfigureWebHost(IWebHostBuilder builder)
{
builder.ConfigureServices(ConfigureServices);
}
private void ConfigureServices(IServiceCollection services)
{
services.RemoveAll(typeof(IMessageService));
2024-11-13 15:38:13 +05:00
services.AddTransient<IMessageService, MessageServiceTest>();
2024-11-12 18:02:09 +05:00
}
}