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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -