![]() |
VOOZH | about |
dotnet add package Shouldly --version 4.3.0
NuGet\Install-Package Shouldly -Version 4.3.0
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageVersion Include="Shouldly" Version="4.3.0" />Directory.Packages.props
<PackageReference Include="Shouldly" />Project file
paket add Shouldly --version 4.3.0
#r "nuget: Shouldly, 4.3.0"
#:package Shouldly@4.3.0
#addin nuget:?package=Shouldly&version=4.3.0Install as a Cake Addin
#tool nuget:?package=Shouldly&version=4.3.0Install as a Cake Tool
đ CI
đ NuGet
đ NuGet
đ 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 https://docs.shouldly.org/.
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
Contributions to Shouldly are very welcome. For guidance, please see
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Shouldly:
| Package | Downloads |
|---|---|
|
CK.Testing
Contains Test Helpers mixin infrastructure. Shouldly is used for assertions. |
|
|
Miru.Testing
Package Description |
|
|
Statiq.Testing
Statiq is a configurable static content generation framework. This library provides utility classes to make testing easier. |
|
|
Takenet.MessagingHub.Client.Tester
The tester library for the C# SDK of the Messaging Hub |
|
|
Saucery2
Sourcery for SauceLabs - Unlocking SauceLabs capability. |
Showing the top 20 popular GitHub repositories that depend on Shouldly:
| Repository | Stars |
|---|---|
|
jasontaylordev/CleanArchitecture
Clean Architecture Solution Template for ASP.NET Core
|
|
|
ardalis/CleanArchitecture
Clean Architecture Solution Template: A proven Clean Architecture Template for ASP.NET Core 10
|
|
|
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.
|
|
|
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+.
|
|
|
aspnetboilerplate/aspnetboilerplate
ASP.NET Boilerplate - Web Application Framework
|
|
|
LuckyPennySoftware/MediatR
Simple, unambitious mediator implementation in .NET
|
|
|
spectreconsole/spectre.console
A .NET library that makes it easier to create beautiful console applications.
|
|
|
LuckyPennySoftware/AutoMapper
A convention-based object-object mapper in .NET.
|
|
|
ThreeMammals/Ocelot
.NET API Gateway
|
|
|
nilaoda/N_m3u8DL-RE
Cross-Platform, modern and powerful stream downloader for MPD/M3U8/ISM. English/įŽäŊ䏿/įšéĢ䏿.
|
|
|
serilog/serilog
Simple .NET logging with fully-structured events
|
|
|
dotnetcore/CAP
Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern
|
|
|
MessagePack-CSharp/MessagePack-CSharp
Extremely Fast MessagePack Serializer for C#(.NET, .NET Core, Unity, Xamarin). / msgpack.org[C#]
|
|
|
fullstackhero/dotnet-starter-kit
Production Grade Cloud-Ready .NET 10 Starter Kit (Web API + React Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.
|
|
|
graphql-dotnet/graphql-dotnet
GraphQL for .NET
|
|
|
FastEndpoints/FastEndpoints
A light-weight REST API development framework for ASP.NET 8 and newer.
|
|
|
kurrent-io/KurrentDB
KurrentDB is a database that's engineered for modern software applications and event-driven architectures. Its event-native design simplifies data modeling and preserves data integrity while the integrated streaming engine solves distributed messaging challenges and ensures data consistency.
|
|
|
dotnet/msbuild
The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
|
|
|
Cysharp/ZLinq
Zero allocation LINQ with LINQ to Span, LINQ to SIMD, and LINQ to Tree (FileSystem, JSON, GameObject, etc.) for all .NET platforms and Unity, Godot.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0-preview.1 | 1,009 | 6/10/2026 |
| 4.3.0 | 29,392,264 | 1/23/2025 |
| 4.2.1 | 26,686,041 | 4/24/2023 |
| 4.2.0 | 217,339 | 4/15/2023 |
| 4.1.0 | 9,226,191 | 8/24/2022 |
| 4.0.3 | 17,991,894 | 12/17/2020 |
| 4.0.2 | 67,671 | 12/17/2020 |
| 4.0.1 | 977,536 | 11/15/2020 |
| 4.0.0 | 341,609 | 11/9/2020 |
| 4.0.0-beta0004 | 21,462 | 10/16/2020 |
| 4.0.0-beta0003 | 28,824 | 9/21/2020 |
| 4.0.0-beta0002 | 994,859 | 6/14/2019 |
| 4.0.0-beta0001 | 227,544 | 1/11/2019 |
| 4.0.0-beta.5 | 744 | 11/8/2020 |
| 3.0.2 | 15,345,523 | 11/6/2018 |
| 3.0.1 | 905,682 | 9/20/2018 |
| 3.0.0 | 3,322,109 | 1/19/2018 |
| 3.0.0-beta0003 | 75,035 | 8/2/2017 |