I have a set of tests with some setup required before each test. The setup requires me to run it async and I don't particularly want to put async code running in a constructor, which is recommended by xunit
public class Tests
{
private async Task SetupForEachTestAsync()
{
// await setup
}
public Tests()
{
SetupForEachTestAsync.GetAwaiter().GetResult();
}
[Fact]
public void Test1()
{
// My test
}
[Fact]
public void Test2()
{
// My test
}
}
Any recommendations on how I can improve this?