chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes

when testing Forms (e.g. with NUnitForms) I test what happens when users click a button. Ahead I set the expectations. When TypeMock encounters an error (e.g. "Unexpected Call to xxx") it throws an exception. Usually its caught by nunit, but in this case the call stack goes back to the message loop. That means the "Unhandled exception has occured" dialog comes up.
As we have automatic tests running a dialog is what we do not expect.
So I tried AppDomain.CurrentDomain.UnhandledException event catching but it did not work at all as the testing class is not in the initial domain.
Does anybody have an idea how to avoid this exception dialog?
I know this problem is not (only) a typical TypeMock issue but perhaps someone can help me in this forum.

Thanks for any help
asked by mknaup (8.5k points)

1 Answer

0 votes
This is actually a problem, and apart from setting up your own error handler, there should probrably have an option to defer throwing the exceptions till the Verify() is called (actually using VerifyWithTimeout() already rethrows these exceptions and it makes more sense to use it in this case as this is a Threaded tests, but TypeMock doesn't have an option not to throw these errors in the first place).

Even with this you might still have problems testing failures in your code.

I will see if we can add this to the coming version
answered by scott (32k points)