Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/296.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# 用扩展方法断言_C#_Unit Testing_Testing - Fatal编程技术网

C# 用扩展方法断言

C# 用扩展方法断言,c#,unit-testing,testing,C#,Unit Testing,Testing,我目前正在使用一个名为Visual Studio Testing Extensions()的库,它允许我以以下方式编写断言: var result = unitUnderTest.MyImportantMethod(); result.ShouldBePositive(); .ShouldBeGreaterThan(4) .ShouldBeLessThan(5.55); 不幸的是,该库已有两年多没有更新,几乎没有被使用(120次下载)。是否有一个更常用且仍在开发中的库

我目前正在使用一个名为Visual Studio Testing Extensions()的库,它允许我以以下方式编写断言:

var result = unitUnderTest.MyImportantMethod();

result.ShouldBePositive();
      .ShouldBeGreaterThan(4)
      .ShouldBeLessThan(5.55);
不幸的是,该库已有两年多没有更新,几乎没有被使用(120次下载)。是否有一个更常用且仍在开发中的库

为了清楚起见,我想要以下功能:

  • 使用扩展方法而不是Assert.xxx方法进行断言
  • 以流畅的语法链接断言
此外,NUnit支持也是必要的

不做你想做的事


我不确定“NUnit支持是必要的”这句话,因为你不想用libarry取代NUnit断言吗?

我不知道有这样一句话,但我一直在寻找一个项目,谢谢你的想法!我将替换NUnit断言,但保留测试框架。