More on nUnit and Exceptions
After complaining about the exception handling in nUnit, I did a quick search on google about it this morning. And oops, nUnit does handle it fairly well after all :-)
There's a method attribute
which does exactly what you'd think - if the exception is thrown, the test passes, otherwise it fails.
[ExpectedException
(typeof(YourExpectedException))]
I'd prefer something that works on the level of a single line of code rather than an entire method, myself, but I'm not going to get picky. You probably shouldn't have more than one test per method, anyway, I suppose.
Now the only question is how none of us at work noticed that useful little attribute .... :-)
Labels: Coding
0 Comments:
Post a Comment
<< Home