Skip to content
Cyrille DUPUYDAUBY edited this page Dec 31, 2019 · 3 revisions

Purpose

This page provides the rationale of (NFluent's) design decisions that are often challenged.

Being opinionated

We (NFluent's team) make clear that we are proponent of TDD and other test first practices. This impacts API design decision in more or less subtle ways. The following entries provide clarification on what this means.

Why does IsEqualTo accepts any type as an expected value ?

IsEqualTo is the cornerstone of test first development, as the developer provides the results she/he expects (hopes?) the code will provide when run in specified conditions. On the other hand, TDD implies writing the test first, as in even before any production code is written. This means the object/value that will hold the result may not be decided yet.

When using NUnit's Assert.AreEqual, this implies you provide the expected value as the first parameter, and the outcome value/objects as the second one. A nice side effect of this, is that the IDE can guess the type of second parameter (same as the first parameter's) helping with autocompletion feature. Sadly, this design is also difficult to read. That's why we decided in favour of what we felt was more readable, i.e.: Check.That(sut)....

Clone this wiki locally