Description
Description
I can still write tests that use ExpectedExceptionAttribute.
Steps to reproduce
Write this test
[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void TestMyStuff()
{
// arrange
var instanceUnderTest = new YourFunkyClass();
DoSomethingThatThrowsArgumentException();
// act // assert
Assert.ThrowsException(()=>instanceUnderTest.DoStuff("badargument");}
}
Expected behavior
I understand backwards compatibility, but ExpectedException is WIDELY recognized to be a source of tests passing when they should be failing. Any test with ExpectedException is effectively useless unless there are absolutely no other calls in the test. You just don't know if it's failing for the reason you expect it to fail, or if it's even getting to the line you want it to fail on.
At a minimum, there needs to be a way to set the test runner to reject it so that if someone brings it in, it fails. By MSTest 3, the attribute should go away entirely.
Actual behavior
I can still use it.
Environment
plain Win10, VS2017.