The Should library

The Should library gives developers an expressive way to assert the expected outcome of a test.

Instead of writing assertions like this:

[Test]
public void then_it_credits_the_account()
{
     Assert.Equals(15.63, _accountBalance);
}

The library provides extension methods that make assertions read more like English and thus are more friendly for humans:

[Test]
public void then_it_credits_the_account()
{
     _accountBalance.ShouldEqual(15.63);
}

Below are some examples of extension methods provided by the Should library.

_account.ShouldBeNull();
_account.ShouldNotBeNull();
_account.ShouldBeType<Account>();
_account.ShouldNotBeType<Vehicle>();

_purchaseConfirmation.ShouldEqual("Your purchase completed successfully");
_purchaseConfirmation.ShouldNotEqual("Your credit card was declined");

// Booleans
_transactionCompleted.ShouldBeTrue();
_transactionCompleted.ShouldBeFalse();

// Strings
"This could be a really long string".ShouldContain("really long string");
"This could be a really long string".ShouldNotContain("something that shouldn't be here");
"This string contains text".ShouldNotBeEmpty();

// Lists
_tags.ShouldContain("Green", "Blue");
_tags.ShouldNotContain("Yellow");
_tags.ShouldBeEmpty();