nunit - NUnit 中 Assert.True 和 Assert.IsTrue 之间的区别?

标签 nunit assert

这两者有什么区别吗?

最佳答案

没有区别。自 v2.5 起添加了 Assert.True() 和其他内容(不含 Is)。

来自版本 2.5 的文档:( nunit v2.5 )

Two forms are provided for the True, False, Null and NotNull conditions. The "Is" forms are compatible with earlier versions of the NUnit framework, while those without "Is" are provided for compatibility with NUnitLite

顺便说一句,反汇编的nunit.framework.dll(使用ILSPY)

public static void IsTrue(bool condition)
{
    Assert.That(condition, Is.True, null, null);
}

public static void True(bool condition)
{
    Assert.That(condition, Is.True, null, null);
}

关于nunit - NUnit 中 Assert.True 和 Assert.IsTrue 之间的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12352448/

相关文章:

c++ - 你能写一个静态断言来验证数据成员的偏移量吗?

java - 断言以随机顺序输出的两个 JSON 结果

node.js - 从 'then' 内的断言返回 promise

python - 我如何重载\覆盖 Python 的断言语句以在断言通过时打印

linux - 从Visual Studio在Linux docker容器中调试nunit测试

f# - F# 项目中的 FsUnit、NUnit 引用

c# - 如何测试返回 IEnumerable<int> 的方法?

c++-cli - 从 C++ CLI 调用 Debug.Assert 的安全方法是什么?

c# - 在 Nunit 控制台中使用 Shims(Microsoft Fakes)运行测试

c# - 新的 HttpConfiguration(); Nunit 失败但 MsTests 失败