tags:

views:

10

answers:

1

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?

A: 

Turns out that Moles doesn't support the ClassInitialize method.

For more information on this issue see:

http://social.msdn.microsoft.com/Forums/en-US/pex/thread/c4e432e5-e657-454a-b90f-cfd37803c961?prof=required

robertz