Hi,
I'm getting this error when multiple tests in a testfixture run.
"TypeMock.TypeMockException :
*** Static constructor for class Roller cannot be faked as it has already
been called
at g4.a(Type A_0)
at g4.b(Type A_0)
at g4.StaticConstructor()"
If I run them one by one it works just fine.
Code
private static Roller GetMockedRoller()
{
Isolate.Fake.StaticConstructor<Roller>();
var mockedRoller =
Isolate.Fake.Instance<Roller>(Members.ReturnRecursiveFakes);
return mockedRoller;
}
Which I understand why it might be happening, so I moved
Isolate.Fake.StaticConstructor<Roller>(); to [TestFixtureSetUp] but when I
do this, it doesn't work expected for the second test, this time Static
constructors are failing in the second test.
How can I solve this problem? Is it a bug, or am I missing something?
Thanks,
James