Hi,
Maybe you can solve this with the injection feature:
You can write a class that represents the "common initialization
logic". Write the logic into the constructor of the class.
public class CommonInit{
public CommonInit()
{
// do comon init logic
}
}
In the class(es) where you have the BeforeScenario WITH tags (make
sure that they are instance methods, not static), add an instance of
the CommonInit.
[Binding]
public class MyScenarioEvents
{
public MyScenarioEvents(CommonInit dummy){}
[BeforeScenario("sometag")]
public void MyEvent(){ ... }
}
When SpecFlow executes, it will create an instance of CommonInit (only
one, even if you inject it into multiple classes), so the constructor
will be executed before the scenario events with tags.
Br,
Gaspar