Multiple Moles redirection not working from ClassInitialize
문제
I have multiple test methods that depend on the same Mole redirection, and in order to prevent duplication, I've placed the redirection code in my ClassInit Method:
[ClassInitialize]
public static void ClassInit(TestContext context)
{
MBase.AllInstances.BaseMethod = b => "Mole";
}
However, when the test methods are run together the redirection only happens once. Why doesn't the redirection occur for each test method?
해결책
Turns out that Moles doesn't support the ClassInitialize method.
For more information on this issue see:
제휴하지 않습니다 StackOverflow