I face an awkward situation - all test classes that have [ClassInitialize] method present fail to execute all test methods inside.
Example:
[TestClass]
public class ChargeAccountServiceTests
{
    private static PrivateType ChargeAccountService_Accessor;
    [ClassInitialize]
    public static void InitializeClass(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context)
    {
         ChargeAccountService_Accessor = new PrivateType(typeof(ChargeAccountService));
    }
    [TestMethod]
    public void TestFixOMRHappySHA()
    {
          //TEST LOGIC
    }
}
Causes test agent to throw following exception:
Test Name:  TestFixOMRHappySHA
Test FullName:  ChargeAccountServiceTests.TestFixOMRHappySHA
Test Source:    \ChargeAccountServiceTests.cs : line 22
Test Outcome:   Failed
Test Duration:  0:00:00
Result Message:
Method ChargeAccountServiceTests.InitializeClass has wrong signature. Parameter 1 should be of type Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.
This test has been working few days ago. Test project target is .NET 3.5
Finally, I got resolved it, by applying combination of tips I found:
From my answer to a similar question, I had the same issue, for me it worked to
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With