Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么xUnit.net中Assert.NotNull的失败消息没有参数?_C#_Xunit.net - Fatal编程技术网

C# 为什么xUnit.net中Assert.NotNull的失败消息没有参数?

C# 为什么xUnit.net中Assert.NotNull的失败消息没有参数?,c#,xunit.net,C#,Xunit.net,与此相反,例如,Assert.False,我可以在断言失败时提供要显示的消息,例如,Assert.NotNull只有一个重载,只需要检查对象。有什么原因吗 namespace Xunit { public class Assert { // ... public static void False(bool condition, string userMessage); // ... public static void NotNull(object @o

与此相反,例如,
Assert.False
,我可以在断言失败时提供要显示的消息,例如,
Assert.NotNull
只有一个重载,只需要检查对象。有什么原因吗

namespace Xunit
{
  public class Assert
  {
    // ...
    public static void False(bool condition, string userMessage);
    // ...
    public static void NotNull(object @object);
    // ...
  }
}

教条。他们认为每个测试不应该有一个以上的断言,因此您不需要它

如果您喜欢xUnit,那么解决方案是下载Assert模块的源代码并将其粘贴到您的项目中。它与其他任何东西都是分开的,因此您可以根据自己的需要进行定制


以下是我对上述库的版本,添加了消息: