【问题标题】:Asserting with extension methods使用扩展方法断言
【发布时间】:2014-08-05 15:25:17
【问题描述】:

我目前正在使用一个名为 Visual Studio 测试扩展 (http://vstestingextensions.codeplex.com/) 的库,它让我可以通过以下方式编写断言:

var result = unitUnderTest.MyImportantMethod();

result.ShouldBePositive();
      .ShouldBeGreaterThan(4)
      .ShouldBeLessThan(5.55);

不幸的是,该库已经 2 年多没有更新了,几乎没有使用过(120 次下载)。是否有更常用且仍在开发中的库?

明确地说,我想要以下功能:

  • 使用扩展方法而不是 Assert.xxx 方法进行断言。
  • 以流畅的语法链接断言

此外,还需要 NUnit 支持。

【问题讨论】:

  • 我不知道有一个,但我一直在寻找一个项目来承担,谢谢你的想法!

标签: c# unit-testing testing


【解决方案1】:

fluent assertions 不做你想做的事吗?

我不确定'NUnit support is neccessary' 语句是否是您想要替换 NUnit 断言的库?

【讨论】:

  • 我正在替换 NUnit 断言,但我保留了测试框架。
猜你喜欢
  • 2013-01-09
  • 1970-01-01
  • 2021-10-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-10-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多