Watch
1
0
Fork
You've already forked test-web
0
test-web/tests/TestFixture.cs
Chris Dill 0e79a8eb5e
All checks were successful
Build / build (push) Successful in 52s
Initial commit
2026-05-30 12:26:50 +01:00

34 lines
811 B
C#

using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using TestWeb.Infra;
[assembly: AssemblyFixture(typeof(TestWeb.Tests.TestFixture))]
namespace TestWeb.Tests;
public class TestFixture : IAsyncLifetime
{
public HttpClient Client { get; private set; } = null!;
private readonly WebApplicationFactory<Program> factory;
public TestFixture()
{
factory = new WebApplicationFactory<Program>();
}
public ValueTask InitializeAsync()
{
Client = factory.CreateClient();
return ValueTask.CompletedTask;
}
public ValueTask DisposeAsync()
{
Client.Dispose();
return ValueTask.CompletedTask;
}
}