Is there any way to create method that will be automatically called before any test?
[Fact]
public void Test1() { }
[Fact]
public void Test2() { }
private void Prepare()
{
// Prepare test environment
}
I need Prepare
to be called before Test1
and Test2
. It should be like this:
- Call
Prepare()
- Call
Test1
- Call
Prepare()
- Call
Test2
I know that i can call it by my own like
[Fact]
public void Test1()
{
Prepare();
}
but is there any way to do it automatically?