Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent VS C# Unit Testing breaking on exceptions

I want to write a unit test for detecting a thrown exception. Using ExpectedExceptionAttribute, I run the test from inside MSVS and when the TestMethod hits the exception, the debugger breaks to the exception but the TestMethod correctly skips over and reports Passed.

Is there a flag to tell VS not to break during unit testing?

like image 885
Jake Avatar asked Aug 27 '12 03:08

Jake


1 Answers

Do not run the tests in a debug session. You have the option to 'Run Selection' or 'Debug selection', choose the first and you should be fine.

like image 190
ChrisBint Avatar answered Sep 17 '22 14:09

ChrisBint