Files
WireMock.Net/test/WireMock.Net.Middleware.Tests/CustomWebApplicationFactory.cs
Stef Heyenrath 42306d1864 Add WireMock.Net.AspNetCore.Middleware (#1175)
* Add WireMock.Net.AspNetCore.Middleware

* .

* WireMock.Net.Middleware.Tests

* .

* X-WireMock-Response-Delay
2024-09-27 20:39:57 +02:00

25 lines
741 B
C#

// Copyright © WireMock.Net
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
namespace WireMock.Net.Middleware.Tests;
internal class CustomWebApplicationFactory<TEntryPoint> : WebApplicationFactory<TEntryPoint>
where TEntryPoint : class
{
private readonly List<(string Key, string Value)> _settings = new();
public CustomWebApplicationFactory(bool alwaysRedirectToWireMock = true)
{
_settings.Add(("AlwaysRedirectToWireMock", alwaysRedirectToWireMock.ToString().ToLowerInvariant()));
}
protected override void ConfigureWebHost(IWebHostBuilder builder)
{
foreach (var arg in _settings)
{
builder.UseSetting(arg.Key, arg.Value);
}
}
}