Shouldly 4.3.0
dotnet add package Shouldly --version 4.3.0
NuGet\Install-Package Shouldly -Version 4.3.0
<PackageReference Include="Shouldly" Version="4.3.0" />
paket add Shouldly --version 4.3.0
#r "nuget: Shouldly, 4.3.0"
// Install Shouldly as a Cake Addin #addin nuget:?package=Shouldly&version=4.3.0 // Install Shouldly as a Cake Tool #tool nuget:?package=Shouldly&version=4.3.0
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 https://docs.shouldly.org/.
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
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- DiffEngine (>= 11.3.0)
- EmptyFiles (>= 4.4.0)
- Microsoft.CSharp (>= 4.7.0)
-
net8.0
- DiffEngine (>= 11.3.0)
- EmptyFiles (>= 4.4.0)
-
net9.0
- DiffEngine (>= 11.3.0)
- EmptyFiles (>= 4.4.0)
NuGet packages (96)
Showing the top 5 NuGet packages that depend on Shouldly:
Package | Downloads |
---|---|
Miru.Testing
Package Description |
|
Saucery2
Sourcery for SauceLabs - Unlocking SauceLabs capability. |
|
Takenet.MessagingHub.Client.Tester
The tester library for the C# SDK of the Messaging Hub |
|
Statiq.Testing
Statiq is a configurable static content generation framework. This library provides utility classes to make testing easier. |
|
Saucery3
Sourcery for SauceLabs - Unlocking SauceLabs capability |
GitHub repositories (261)
Showing the top 5 popular GitHub repositories that depend on Shouldly:
Repository | Stars |
---|---|
MaterialDesignInXAML/MaterialDesignInXamlToolkit
Google's Material Design in XAML & WPF, for C# & VB.Net.
|
|
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
|
|
aspnetboilerplate/aspnetboilerplate
ASP.NET Boilerplate - Web Application Framework
|
|
jbogard/MediatR
Simple, unambitious mediator implementation in .NET
|
|
AutoMapper/AutoMapper
A convention-based object-object mapper in .NET.
|
Version | Downloads | Last updated |
---|---|---|
4.3.0 | 0 | 1/23/2025 |
4.2.1 | 12,688,614 | 4/24/2023 |
4.2.0 | 168,569 | 4/15/2023 |
4.1.0 | 7,376,200 | 8/24/2022 |
4.0.3 | 15,676,345 | 12/17/2020 |
4.0.2 | 49,815 | 12/17/2020 |
4.0.1 | 894,782 | 11/15/2020 |
4.0.0 | 290,203 | 11/9/2020 |
4.0.0-beta0004 | 19,491 | 10/16/2020 |
4.0.0-beta0003 | 26,267 | 9/21/2020 |
4.0.0-beta0002 | 890,367 | 6/14/2019 |
4.0.0-beta0001 | 222,534 | 1/11/2019 |
4.0.0-beta.5 | 499 | 11/8/2020 |
3.0.2 | 13,489,471 | 11/6/2018 |
3.0.1 | 849,149 | 9/20/2018 |
3.0.0 | 3,026,128 | 1/19/2018 |
3.0.0-beta0003 | 71,453 | 8/2/2017 |
3.0.0-beta0001 | 3,283 | 7/19/2017 |
2.8.3 | 1,326,895 | 6/5/2017 |
2.8.2 | 1,339,287 | 8/13/2016 |
2.8.1 | 82,529 | 7/23/2016 |
2.8.0 | 262,204 | 6/17/2016 |
2.7.0 | 220,269 | 4/4/2016 |
2.7.0-beta0003 | 3,589 | 2/2/2016 |
2.7.0-beta0002 | 1,660 | 1/30/2016 |
2.7.0-beta0001 | 2,097 | 1/2/2016 |
2.6.0 | 442,397 | 9/6/2015 |
2.5.0 | 148,009 | 4/12/2015 |
2.4.0 | 70,947 | 1/29/2015 |
2.3.1 | 25,584 | 12/15/2014 |
2.3.0 | 4,768 | 11/21/2014 |
2.2.1 | 9,068 | 10/22/2014 |
2.2.0 | 26,971 | 9/8/2014 |
2.1.1 | 67,511 | 3/19/2014 |
2.1.0 | 4,556 | 3/13/2014 |
1.1.1.1 | 264,679 | 4/21/2012 |
1.1.1 | 3,373 | 3/9/2012 |
1.1.0.6 | 1,737 | 4/21/2012 |
1.1.0.4 | 10,573 | 11/18/2011 |
1.1.0.3 | 1,810 | 11/15/2011 |
1.1.0.2 | 1,812 | 11/15/2011 |
1.1.0.1 | 1,869 | 11/3/2011 |
1.1.0 | 2,293 | 9/23/2011 |
1.0.1.77 | 1,983 | 9/13/2011 |
1.0.1.73 | 2,805 | 7/31/2011 |
1.0.1.71 | 1,897 | 7/31/2011 |
1.0.1.69 | 1,978 | 5/26/2011 |
1.0.1.68 | 2,019 | 5/25/2011 |
1.0.1.67 | 2,055 | 5/18/2011 |
1.0.1.66 | 1,968 | 5/18/2011 |
1.0.1.63 | 2,103 | 3/28/2011 |
1.0.1.62 | 2,086 | 3/17/2011 |
1.0.1.60 | 54,598 | 2/24/2011 |