Using Xunit, how can I get the name of the currently running test?
public class TestWithCommonSetupAndTearDown : IDisposable
{
public TestWithCommonSetup
See a similar question in Github where the answer/workaround is to use some injection and reflection i the constructor.
public class Tests
{
public Tests(ITestOutputHelper output)
{
var type = output.GetType();
var testMember = type.GetField("test", BindingFlags.Instance | BindingFlags.NonPublic);
var test = (ITest)testMember.GetValue(output);
}
<...>
}