Logo

dev-resources.site

for different kinds of informations.

Improving Unit Test Readability In .Net With Fluent Assertions

Published at
4/16/2018
Categories
dotnet
testing
unittest
fluentassertions
Author
Matheus Rodrigues
Improving Unit Test Readability In .Net With Fluent Assertions

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: Assert.Equal(“ExpectedResult”, “ActualResult”).

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.

Continue Reading... Improving Unit Test Readability In .Net With Fluent Assertions

Featured ones: