Are your unit tests still hard to read ? – Should Assertion Library


I created the Should library to fill a gap in the testing ecosystem in the .Net space.  Simply put, I took what I liked about using extension methods to make a more readable set of assertions, but made the library independent of any specific unit test framework. The last point is important, because this library can be used with all unit test frameworks. There were similar tools to this previously, but they all were tied to specific libraries so I could not have a consistent language when I move between test frameworks.

Cleaner syntax

First, consider the syntax and the readability of the assertions of a unit test. This is what a null check looks like using should.

foo.ShouldBeNull();

versus the equivalent syntax using MSTest.

Assert.Null(foo);

Install it now

Should is available on nuget.

install-package Should

Learn more about it

Start by watching this short video

There are a number of place to learn more about Should.

There is a second dialect of Should called Should.Fluent.  Learn about it here:

Using sql compact for integration tests with entity framework.