laurentkempe / shouldly

Should testing for .net - the way Asserting *Should* be!

Home Page:http://docs.shouldly-lib.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Icon

Shouldly

Join the chat at https://gitter.im/shouldly/shouldly Shouldly is an assertion framework which focuses on giving great error messages when the assertion fails while being simple and terse.

This is the old Assert way:

Assert.That(contestant.Points, Is.EqualTo(1337));

For your troubles, you get this message, when it fails:

Expected 1337 but was 0

How it Should be:

contestant.Points.ShouldBe(1337);

Which is just syntax, so far, but check out the message when it fails:

contestant.Points should be 1337 but was 0

It might be easy to underestimate how useful this is. Another example, side by side:

Assert.That(map.IndexOfValue("boo"), Is.EqualTo(2));    // -> Expected 2 but was 1
map.IndexOfValue("boo").ShouldBe(2);                    // -> map.IndexOfValue("boo") should be 2 but was 1

Shouldly uses the code before the ShouldBe statement to report on errors, which makes diagnosing easier.

Read more about Shouldly and it's features at http://docs.shouldly-lib.net/

Contributing

Getting started with Git and GitHub

Once you're familiar with Git and GitHub, clone the repository and start contributing.

If you need inspiration for which issue to pick up have a look for the Jump-In label on issues which are put on issues which are ready to be picked up by anyone.

Icon

Star created by Luboš Volkov from The Noun Project

About

Should testing for .net - the way Asserting *Should* be!

http://docs.shouldly-lib.net

License:Other


Languages

Language:HTML 66.1%Language:Ruby 16.9%Language:C 8.3%Language:C# 7.1%Language:CSS 1.0%Language:JavaScript 0.5%Language:Bison 0.1%Language:XSLT 0.0%Language:Shell 0.0%