I want to build integration tests to make sure all of our endpoints are locked behind authentication.
I will then fetch all of our endpoints from our swagger. How can i await this call and then use this data as memberData or classData? Since it's async. Should i use fixtures, or some kind of ----Data?
[Collection("A collection")]
public class EndpointsTests
{
RouteDataFixture fixture;
public EndpointsTests(RouteDataFixture fixture)
{
this.fixture = fixture;
}
[Theory]
[ClassData(typeof(SomeClassWithAsyncConstructor))]
public async Task Test_This(string path, string method)
{
//test the awaited data from class
if(method == "GET"=
var response = await fixture.GetAsync(path)
//Check if the response is unauthorized since we didn't send a token
}
}