Friday, April 8, 2011

Why does this unit test pass in Visual Studio 2005 but fail in VS2008?

[TestMethod]
[ExpectedException(typeof(FormatException))]
public void PassGodammit()
{
    throw new FormatException();
}

?? driving me mad.

From stackoverflow
  • Make sure to check your project references after you upgrade from 2005 to 2008: for some odd reason the Upgrade Wizard does not upgrade references to Microsoft.VisualStudio.QualityTools.UnitTestFramework and leaves references to version 8.0 of this assembly. Just manually add a reference to v 9.0 of this assembly.

  • I just copied your code to my VS2008. It gets a "Passed" as a result. Do you have any other info? It works well for me.

0 comments:

Post a Comment