c# - how I attribute unit test with data driven and expected exception -


i have unit test function, attribute 'datadriven'. calls function expected throw exception. if attribute both first method or twice "expectedexception" fails, , doesn't continue other rows on data source. should do?

you can use assert.throws() method in nunit verify method within test throws exception.

assert.throws<filenotfoundexception>(() => thismethodthrowsfilenotfound()); 

the expectedexception attribute meant used on test method (the 1 test attribute). decorating other method has no effect.


Comments