c# - Ignoring exceptions handled by other assembly -
i have application smoke testing several key services. want these tests written , self discovering. end, have created attribute each method in style of [testmethod] mstest. have created object find these methods , execute them within try-catch. if method throws exception report failure, otherwise success.
this unit test familiar , intention. test like...
[mytestattribute] public void testingtimesahead() { var d = datetime.maxvalue.adddays(1); }
the magic happens in test object, has action property , run method...
public action testaction { get; private set; } public override itestresult runtest() { try { this.testaction.invoke(); return new basetestresult() { result = testresultstatus.success }; } catch(exception ex) { return new basetestresult() { result = testresultstatus.failure, failureexception = ex}; } }
when ran in isolation above test, being wrapped action, cause exception , test fails. perfect.
however, when wrap attributes , test running object dll , reference new project, vs debugger breaks exception. presented option in dialog toggle 'break when exception type user-unhandled'.
i can suppress exceptions on type type basis, isn't going work reuse. also, if run release build bin output, expected behaviour there - it's awkward development experience.
is possible manage exception setting code instead? or if can suggest way around problem, i'm open ideas.
Comments
Post a Comment