Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between "Fluent Assertions" and "Should Assertion Library"

  • Can someone point the differences?

The above is really my question, but if you can also share your experience with them and why you use one or the other.

like image 490
Luis Avatar asked Apr 30 '13 12:04

Luis


2 Answers

They are just two different libraries, so just look at the features, and especially at the reporting capabilities and take your pick.

As I am the author of Fluent Assertions, I'm obviously biased. Regardless, I take big pride in the effort we've been putting in making the error messages as clear as possible so that we can keep you out of the debugger hell.

like image 195
Dennis Doomen Avatar answered Oct 22 '22 12:10

Dennis Doomen


SA-'s example of FluentAssertions is incorrect. The examples should be:

  • FluentAssertions: variable.Should().Be(10);
  • Shouldly: variable.ShouldBe(10);

As you can see there is barely any difference in usage for this simple example.

I've found FluentAssertions to be the slightly more hands on, but more powerful library, with Shouldly lacking some features. The error messages of Shouldly are indeed a bit better with using natural language, but I wouldn't go as far as say they're less technical.

like image 36
Alexander Avatar answered Oct 22 '22 11:10

Alexander