ExampleSignalR/TestProject/WebAppFactoryFixture.cs
2024-11-13 15:38:13 +05:00

22 lines
638 B
C#

using ExampleSignalR.Test.Services;
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));
services.AddTransient<IMessageService, MessageServiceTest>();
}
}