ExpectedException Attribute missing in Visual Studio 2012 RC
So Visual Studio 2012 RC is out …time to open up all our projects and see what no longer works.
Hit an issue with my unit test projects, the namespace in these projects, ‘Microsoft.VisualStudio.TestTools.UnitTesting’ has been renamed to ‘Microsoft.VisualStudio.TestPlatform.UnitTestFramework’
A quick ‘Find & Replace’ updated all the references …and I thought the job was done until the compiler reported:
‘The type or namespace name 'ExpectedExceptionAttribute' could not be found (are you missing a using directive or an assembly reference?)’
It appears this attribute has been either moved or removed from the framework.
Possible because there is an improved mechanism for Asserting exceptions now. Its possible to replace the [ExpectedException] attribute with the following test code:
Assert.ThrowsException<InvalidOperationException>(()=>ThrowException());
Although this is a fantastic improvement over the attributed version; it leaves me in a predicament of having lots and lots of unit tests to fix-up
If anyone discovers that this attribute does exist somewhere please let me know