我有这个简单的测试
[Test]
[ExpectedException(typeof(Exception))]
public void Test2()
{
throw new Exception();
}
因为我知道这个测试失败了因为我被指示看到这样的异常,但它失败并出现此错误
Test Name: Test2
Test FullName: Framework.Tests.Service.BaseServiceTest.Test2
Test Source: c:\Framework.Tests\Service\BaseServiceTest.cs : line 75
Test Outcome: Failed
Test Duration: 0:00:00.189
Result StackTrace: at Framework.Tests.Service.BaseServiceTest.Test2() in c:\Framework.Tests\Service\BaseServiceTest.cs:line 76
Result Message: System.Exception : Exception of type 'System.Exception' was thrown.
我也尝试过其他类型的异常,结果是相同的