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
0 votes
try the following production code
public class ExceptionClass
{
   public static void WillThrowException()
  {
     throw new Exception();
  }
}


and the following test code
     Assert.Throws<Exception>(
                () => Isolate.Invoke.Method(typeof (ExceptionClass), "WillThrowException"));


Expected: the above code should pass.

But, it failed.
________
Colorado medical marijuana dispensaries
asked by nsoonhui (59.1k points)

2 Answers

0 votes
The issue is that Invoke.Method throws TargetInvocationException instead of the expected exception.

I will fix this issue and send you a patch
answered by dhelper (11.9k points)
0 votes
I have a problem with the same method when the Invoked method throws from a mocked method; the test is ended abruptly with the thrown exception even though the exception is caught in the test.

See https://www.typemock.com/community/viewt ... =6673#6673
answered by patrick.gill@verint. (2.6k points)
...