The assertion in unit tests is the phase where we verify if the test result is what we expect. This phase is straightforward, usually it is just one line. But it is not very readable, because it looks something like this:
There is no logical order in expected result and actual result parameter, this always confuses me. Other aspect about readability is that it is not human readable. If you try to read a code like this out loud it is not sound that good.
To solve this problem, frameworks to improve readability in assertions were created, like, Fluent Assertions framework for .net. As the name say, this framework use a fluent interface to create readable assertions.
In this post, I’m going to show how Fluent Assertions can improve the unit test readability.