我有一个.net 4.0测试项目,它为Should()扩展方法抛出了一个找不到异常的方法.
然后我注意到它也为int类型抛出异常.
有人知道FluentAssertions V3为什么会这样吗?
现在我要回到我的2.2版本.
作为参考,这是FluentAssersions项目网站https://github.com/dennisdoomen/fluentassertions/releases
这是代码示例:

var actualItems = new List<string> { "" };
actualItems.All(i => i == "X").Should().BeTrue("All items should be X") ;
Run Code Online (Sandbox Code Playgroud)
这是一个例外:
Error 237 'bool' does not contain a definition for 'Should'
and no extension method 'Should' accepting a first argument of type 'bool'
could be found (are you missing a using directive or an assembly reference?)
C:\pathtoproject\Tests.cs
Run Code Online (Sandbox Code Playgroud)
那是因为v3.0需要.NET 4.0.3用于测试项目.这是Portable Class Libraries支持的最早版本.这有点令人困惑,但如果您已经安装了.NET 4.5,那么您已经在使用4.0.3了.我已更新发行说明.
| 归档时间: |
|
| 查看次数: |
1626 次 |
| 最近记录: |