DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,274 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Matheus Rodrigues
Matheus Rodrigues

Posted on • Originally published at matheus.ro on

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

Top comments (0)

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. πŸ›