Is there a simple (Attribute-driven) way to have the following test fail on the message of the exception.
[TestMethod()]
[ExpectedException(typeof(ArgumentException))]
public void ExceptionTestTest()
{
throw new ArgumentException("BBB");
}
I would Like to have the test pass if the message in the exception is BBB , but fail if it is anything else. I looked at the second parameter of the ExpectedException attribute, but that is only a message to display in the test report if the Exception type is different.
I know I can try {} catch {} the exception an then assert that the message IsEqual to the message, but that feels clunky.
PS. I'm using the built in Unit testing of Visual Studio 2008 (pro)