Isolate.Fake.StaticConstructor - works only once

0 votes
Hi -

I need to fake a static contractor type.
I added the following to my test class :
        public static void InitClass(TestContext tc)
            //// fake icfc element creation
            Isolate.Fake.StaticMethods(typeof(Factory), Members.ReturnRecursiveFakes);            

i have 2 test methods which uses this fake but is seems that it apply only for thr first one, the second one actually invokes the static ctor for some reason and fails.

i'm using typemock version 6.0.10.

can anyone can explain why is it behave like that ?
asked Apr 21, 2013 by itayer (120 points)

1 Answer

0 votes
You can workaround this issue using our old API:

        public void InitTest()
            MockManager.MockAll(typeof (Factory));

MockManager.MockAll should be used before every test or in it's beginning so it's best to put it in the [TestInitialize].

You can find more info on MockAll here.


Alex Galin | Support Team

answered Apr 25, 2013 by alex (17,950 points)