Should testing for .NET - the way Asserting *Should* be!
Clone or download
jnm2 and JosephWoodward Removed irrelevant stack frames from exception stack traces (#501)
* Failing tests for relevant stack trace

* Removed irrelevant stack frames from exceptions

* Failing tests for matching trailing whitespace of default stack trace

* Match trailing whitespace of default exception stack trace
Latest commit b3acc89 Sep 21, 2018
Permalink
Failed to load latest commit information.
assets Add new logos Jan 19, 2018
docs Decreased resolution of images Jun 18, 2016
package Replace Thread.Sleep with Task.Wait Jan 22, 2018
src Removed irrelevant stack frames from exception stack traces (#501) Sep 21, 2018
tools Update cake build script for new tooling Jul 21, 2017
.gitattributes Adding .gitattributes Feb 3, 2014
.gitignore Update cake build script for new tooling Jul 21, 2017
BREAKING CHANGES.txt Updated deployment readme Jun 18, 2016
CONTRIBUTING.md Split out contributing guidelines into their own file. In line with G… Oct 6, 2016
GitVersionConfig.yaml Update cake build script for new tooling Jul 21, 2017
LICENSE.txt Added NUnit, ILMerge, NuPack dependencies Oct 28, 2010
NuGet.config Added MSBuild.Sdk.Extras as suggested in NuGet/Home#5021 Jul 5, 2017
README.md Syntax highlight (#500) Apr 30, 2018
ReleaseProcessReadme.md Release process formatting Jun 18, 2016
appveyor.deploy.yml Make sure each build builds the right thing Jun 14, 2016
appveyor.yml Initial tooling migration commit Jul 5, 2017
build.cake Update cake build script for new tooling Jul 21, 2017
build.ps1 Update to latest build.ps1 from cake Jul 14, 2017
build.sh Make build.sh executable Jul 14, 2017
deploy.cake Add in nuget push source Jun 17, 2016
deploy.ps1 Update cake build script for new tooling Jul 21, 2017
global.json .NET Standard tests (#479) Jan 25, 2018
mkdocs.yml Updated heading Sep 30, 2015
package_icon.png Resized icon Mar 31, 2015

README.md

Shouldly Logo

Build Status NuGet NuGet Documentation Status

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 its features at http://docs.shouldly-lib.net/.

Installation

Shouldly can be found here on NuGet and can be installed by copying and pasting the following command into your Package Manager Console within Visual Studio (Tools > NuGet Package Manager > Package Manager Console).

Install-Package Shouldly

Alternatively if you're using .NET Core then you can install Shouldly via the command line interface with the following command:

dotnet add package Shouldly

Contributing

Contributions to Shouldly are very welcome. For guidance, please see CONTRIBUTING.md

Pre-requisites for running on build server

Shouldly uses the source code to make its error messages better. Hence, on the build server you will need to have the "full" pdb files available where the tests are being run.

What is meant by "full" is that when you set up your "release" configuration in Visual Studio and you go to Project Properties > Build > Advanced > Debug, you should set it to "full" rather than "pdb-only".

Currently maintained by

If you are interested in helping out, jump on Gitter and have a chat.

Brought to you by

  • Dave Newman
  • Xerxes Battiwalla
  • Anthony Egerton
  • Peter van der Woude
  • Jake Ginnivan