我正在利用NUNIT进行这一试验,并将NUNIT附属于视觉演播室(Debug -->Atach to Process --> Selected nunit.exe)。
I was expecting the statement "throw new Exception("Exception 1 occured!");"to move the control into the catch block but the control does not jump to the "catch" but instead jumps to method2().
当我刚刚处理Nnunit测试案时,没有把Nnunit.exe附在“视力”演播室上,该密码通常会发生。
public void test()
{
try
{
method1();
if (condition1)
{
throw new Exception("Exception 1 occured!");
}
method2();
if (condition2)
{
throw new Exception("Exception 2 occured!");
}
method3();
if (condition3)
{
throw new Exception("Exception 3 occured!");
}
}
catch (Exception Ex) <---- Exceptions thrown above are caught here
{
logMessage(E.Message);
throw;
}
}