I'm running Isolator 5.1.2.0 on Windows Server 2008 Enterprise, using VS 2008. My tests have this class initializer:
[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
// This method can only be called once.
Isolate.Fake.StaticConstructor(typeof(SPUtility));
}
I do a full rebuild of my solution. When I run the tests under VS (menu item Test, Run, All Tests in Solution), all but one of the tests fail with the error:
Class Initialization method [...].ClassInitialize threw exception. TypeMock.TypeMockException: TypeMock.TypeMockException:
*** Static constructor for class SPUtility cannot be faked as it has already been called.
But when I run the tests from the command line -- or, more precisely, when I run MSBuild and build my projects "UnitTest" target, which runs this command:
$(TypeMockPath)TMockRunner.exe -logpath $(TypeMockLogPath) MSTest.exe /testcontainer:$(inetroot)privateTestUnitTestin$(Configuration)MyProject.UnitTest.dll
... then the tests pass. This is repeatable.
Thanks for any help,
Larry