nunit - Assert.Pass() 抛出异常

标签 nunit typemock nunit-2.5.9

我有一个构造函数如下

public class MyClass
{
   public MyClass()
   {

   }
}

在编写测试用例时,我使用了 Assert.Pass()。 但它抛出了 ArguementNullException 类型的异常

最佳答案

SuccessException 为测试运行者提供了便利。这允许您通过测试并记录可选消息。解决此问题的更好方法是让测试完成,而不抛出任何异常或记录失败的断言。

更多信息请点击:http://www.nunit.org/index.php?p=utilityAsserts&r=2.5

关于nunit - Assert.Pass() 抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17317881/

相关文章:

c# - IHeadersDictionary 在模拟后返回 null

nunit - 使用通配符从控制台忽略 NUnit 测试

mocking - Moq 和 Rhino.mocks 的功能是什么?

google-chrome - 使用 TFS/NUnit 通过构建过程执行时,使用 Google Chrome 的 WebDriver 测试挂起

sql-server-2000 - 我可以在 Nunit 中创建数据库死锁测试吗?

c# - 当参数实现通用接口(interface)时,NUnit 通用测试夹具不显示

c# - c# 是否有类似 rspec 的测试框架,可以将类似的测试分组在一起?

unit-testing - 有没有使用 TypeMock 的团队?值得付出高昂的代价吗?

c# - Mocking 是否能够替换包装在方法中的功能?