views:

76

answers:

1

This is wierd, but all of a sudden the `ExpectedExceptionAttribute' quit working for me the other day. Not sure what's gone wrong. I'm running VS 2010 and VS 2005 side-by-side. It's not working in VS 2010. This test should pass, however it is failing:

    [TestMethod]
    [ExpectedException(typeof(ArgumentNullException))]
    public void Test_Exception()
    {
        throw new ArgumentNullException("test");
    }

Any ideas? This really sux.

A: 

I've had the same issue, but finally managed to get it working. Not really sure how but here's a list of things I did between it not working to when it started working again.

  • Converted the project being tested to .NET 4
  • Turned off CodeCoverage
  • Turned CodeCoverage back on again
  • Did a RebuildAll on the test project

Not sure which bit fixed it though. Anyway, hope this helps!

Jon Mitchell