When running MSTEST unit tests in debug mode, the execution stops in every expected exception that is thrown. My test looks like this
[TestMethod()]
[ExpectedException(typeof(ArgumentNullException))]
public void ShouldThrowExceptionWhenPassingNull()
{
object data = null;
target.CheckNull(data);
}
the target method looks like this:
public void CheckNull(object data)
{
if (ReferenceEquals(null, data))
{
throw new ArgumentNullException("data");
}
} // test run breaks here: ArgumentNullException was unhandled by user code