Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have a unit test project which references FluentAssertions, I get errors when I update to version 3

I have a .net 4.0 test project which is throwing a method not found exceptions for the Should() extension method.

Then I noticed it also was throwing exceptions for an int type as well.

Does anybody know why FluentAssertions V3 is behaving this way?

For now I am going back to my version 2.2.

For reference, this is the FluentAssersions project website https://github.com/dennisdoomen/fluentassertions/releases

here's the code sample: enter image description here

var actualItems = new List<string> { "" };
actualItems.All(i => i == "X").Should().BeTrue("All items should be X") ;

here's an exceptions:

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
like image 923
BraveNewMath Avatar asked Apr 29 '14 17:04

BraveNewMath


1 Answers

That's because v3.0 requires .NET 4.0.3 for your test projects. This is the earliest version supported by the Portable Class Libraries. It's a bit confusing, but if you already installed .NET 4.5, you are already using 4.0.3. I have updated the release notes.

like image 176
Dennis Doomen Avatar answered Sep 22 '22 17:09

Dennis Doomen