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 (100)
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 (282)
Showing the top 5 popular GitHub repositories that depend on Shouldly:
Repository | Stars |
---|---|
icsharpcode/ILSpy
.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
|
|
ardalis/CleanArchitecture
Clean Architecture Solution Template: A starting point for Clean Architecture with ASP.NET Core
|
|
MaterialDesignInXAML/MaterialDesignInXamlToolkit
Google's Material Design in XAML & WPF, for C# & VB.Net.
|
|
App-vNext/Polly
Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. From version 6.0.1, Polly targets .NET Standard 1.1 and 2.0+.
|
|
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.
|
Version | Downloads | Last updated |
---|---|---|
4.3.0 | 241,570 | 1/23/2025 |
4.2.1 | 13,370,694 | 4/24/2023 |
4.2.0 | 170,827 | 4/15/2023 |
4.1.0 | 7,452,505 | 8/24/2022 |
4.0.3 | 15,788,062 | 12/17/2020 |
4.0.2 | 50,754 | 12/17/2020 |
4.0.1 | 898,557 | 11/15/2020 |
4.0.0 | 291,401 | 11/9/2020 |
4.0.0-beta0004 | 19,655 | 10/16/2020 |
4.0.0-beta0003 | 26,377 | 9/21/2020 |
4.0.0-beta0002 | 894,111 | 6/14/2019 |
4.0.0-beta0001 | 222,836 | 1/11/2019 |
4.0.0-beta.5 | 501 | 11/8/2020 |
3.0.2 | 13,556,453 | 11/6/2018 |
3.0.1 | 851,604 | 9/20/2018 |
3.0.0 | 3,039,351 | 1/19/2018 |
3.0.0-beta0003 | 71,643 | 8/2/2017 |
3.0.0-beta0001 | 3,285 | 7/19/2017 |
2.8.3 | 1,331,136 | 6/5/2017 |
2.8.2 | 1,347,540 | 8/13/2016 |
2.8.1 | 82,986 | 7/23/2016 |
2.8.0 | 262,886 | 6/17/2016 |
2.7.0 | 221,085 | 4/4/2016 |
2.7.0-beta0003 | 3,591 | 2/2/2016 |
2.7.0-beta0002 | 1,662 | 1/30/2016 |
2.7.0-beta0001 | 2,099 | 1/2/2016 |
2.6.0 | 443,559 | 9/6/2015 |
2.5.0 | 148,093 | 4/12/2015 |
2.4.0 | 71,041 | 1/29/2015 |
2.3.1 | 25,647 | 12/15/2014 |
2.3.0 | 4,793 | 11/21/2014 |
2.2.1 | 9,089 | 10/22/2014 |
2.2.0 | 26,985 | 9/8/2014 |
2.1.1 | 67,670 | 3/19/2014 |
2.1.0 | 4,570 | 3/13/2014 |
1.1.1.1 | 265,530 | 4/21/2012 |
1.1.1 | 3,377 | 3/9/2012 |
1.1.0.6 | 1,743 | 4/21/2012 |
1.1.0.4 | 10,582 | 11/18/2011 |
1.1.0.3 | 1,817 | 11/15/2011 |
1.1.0.2 | 1,819 | 11/15/2011 |
1.1.0.1 | 1,875 | 11/3/2011 |
1.1.0 | 2,299 | 9/23/2011 |
1.0.1.77 | 1,987 | 9/13/2011 |
1.0.1.73 | 2,811 | 7/31/2011 |
1.0.1.71 | 1,903 | 7/31/2011 |
1.0.1.69 | 1,984 | 5/26/2011 |
1.0.1.68 | 2,025 | 5/25/2011 |
1.0.1.67 | 2,061 | 5/18/2011 |
1.0.1.66 | 1,974 | 5/18/2011 |
1.0.1.63 | 2,109 | 3/28/2011 |
1.0.1.62 | 2,092 | 3/17/2011 |
1.0.1.60 | 55,662 | 2/24/2011 |