This commit is contained in:
commit
1199bef0c8
1 changed files with 1200 additions and 0 deletions
28
tests/TestFixture.cs
Normal file
28
tests/TestFixture.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
|
||||
[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;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue