【问题标题】:XUnit Asserting Exceptions In Debug Mode In Visual StudioXUnit 在 Visual Studio 的调试模式下断言异常
【发布时间】:2018-12-11 15:43:33
【问题描述】:

我认为您无法运行此代码是否正确:

Assert.Throws<FormatException>(()=> 
{
     int test;
     test = int.Parse("forty two");

});

处于调试模式?它会抛出一个错误,并且该错误不会被

Assert.Throws<FormatException>

所以测试会失败。

【问题讨论】:

    标签: c# visual-studio xunit


    【解决方案1】:

    看看这个,How to prevent expected exceptions from breaking the debug test run?

    可能是您的 Visual Studio 设置错误,而不是 xunit

    【讨论】:

      猜你喜欢
      • 2017-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-15
      相关资源
      最近更新 更多