tests: setup initial infra for end to end tests

This commit is contained in:
Stevan Freeborn
2024-04-03 16:21:38 -05:00
parent c7c24965b3
commit 1f5d45f003
10 changed files with 98 additions and 3 deletions
+28
View File
@@ -0,0 +1,28 @@
namespace Blog.Tests.EndToEnd;
public class CompositeHost(IHost testHost, IHost kestrelHost) : IHost
{
private readonly IHost _testHost = testHost;
private readonly IHost _kestrelHost = kestrelHost;
public IServiceProvider Services => _testHost.Services;
public void Dispose()
{
_testHost.Dispose();
_kestrelHost.Dispose();
GC.SuppressFinalize(this);
}
public async Task StartAsync(CancellationToken cancellationToken = default)
{
await _testHost.StartAsync(cancellationToken);
await _kestrelHost.StartAsync(cancellationToken);
}
public async Task StopAsync(CancellationToken cancellationToken = default)
{
await _testHost.StopAsync(cancellationToken);
await _kestrelHost.StopAsync(cancellationToken);
}
}