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" />
<PackageVersion Include="Shouldly" Version="4.3.0" />
<PackageReference Include="Shouldly" />
paket add Shouldly --version 4.3.0
#r "nuget: Shouldly, 4.3.0"
#addin nuget:?package=Shouldly&version=4.3.0
#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 (105)
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 |
|
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. |
GitHub repositories (278)
Showing the top 20 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 proven Clean Architecture Template for ASP.NET Core 9
|
|
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.
|
|
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.
|
|
spectreconsole/spectre.console
A .NET library that makes it easier to create beautiful console applications.
|
|
ThreeMammals/Ocelot
.NET API Gateway
|
|
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#]
|
|
graphql-dotnet/graphql-dotnet
GraphQL for .NET
|
|
dotnet/msbuild
The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
|
|
FastEndpoints/FastEndpoints
A light-weight REST API development framework for ASP.NET 8 and newer.
|
|
jasontaylordev/NorthwindTraders
Northwind Traders is a sample application built using ASP.NET Core and Entity Framework Core.
|
|
codebude/QRCoder
A pure C# Open Source QR Code implementation
|
|
MapsterMapper/Mapster
A fast, fun and stimulating object to object Mapper
|
|
Code52/carnac
A utility to give some insight into how you use your keyboard
|
Version | Downloads | Last updated |
---|---|---|
4.3.0 | 1,472,143 | 3 months ago |
4.2.1 | 15,432,897 | 4/24/2023 |
4.2.0 | 178,407 | 4/15/2023 |
4.1.0 | 7,727,703 | 8/24/2022 |
4.0.3 | 16,119,310 | 12/17/2020 |
4.0.2 | 53,962 | 12/17/2020 |
4.0.1 | 909,052 | 11/15/2020 |
4.0.0 | 296,113 | 11/9/2020 |
4.0.0-beta0004 | 20,051 | 10/16/2020 |
4.0.0-beta0003 | 26,713 | 9/21/2020 |
4.0.0-beta0002 | 906,699 | 6/14/2019 |
4.0.0-beta0001 | 223,847 | 1/11/2019 |
4.0.0-beta.5 | 526 | 11/8/2020 |
3.0.2 | 13,750,043 | 11/6/2018 |
3.0.1 | 859,001 | 9/20/2018 |
3.0.0 | 3,074,893 | 1/19/2018 |
3.0.0-beta0003 | 72,095 | 8/2/2017 |
3.0.0-beta0001 | 3,376 | 7/19/2017 |
2.8.3 | 1,348,503 | 6/5/2017 |
2.8.2 | 1,378,211 | 8/13/2016 |
2.8.1 | 84,244 | 7/23/2016 |
2.8.0 | 263,719 | 6/17/2016 |
2.7.0 | 224,515 | 4/4/2016 |
2.7.0-beta0003 | 3,681 | 2/2/2016 |
2.7.0-beta0002 | 1,754 | 1/30/2016 |
2.7.0-beta0001 | 2,198 | 1/2/2016 |
2.6.0 | 448,330 | 9/6/2015 |
2.5.0 | 150,471 | 4/12/2015 |
2.4.0 | 72,387 | 1/29/2015 |
2.3.1 | 25,989 | 12/15/2014 |
2.3.0 | 4,989 | 11/21/2014 |
2.2.1 | 9,220 | 10/22/2014 |
2.2.0 | 27,125 | 9/8/2014 |
2.1.1 | 68,772 | 3/19/2014 |
2.1.0 | 4,774 | 3/13/2014 |
1.1.1.1 | 267,011 | 4/21/2012 |
1.1.1 | 3,483 | 3/9/2012 |
1.1.0.6 | 1,848 | 4/21/2012 |
1.1.0.4 | 10,692 | 11/18/2011 |
1.1.0.3 | 1,924 | 11/15/2011 |
1.1.0.2 | 1,927 | 11/15/2011 |
1.1.0.1 | 1,984 | 11/3/2011 |
1.1.0 | 2,406 | 9/23/2011 |
1.0.1.77 | 2,101 | 9/13/2011 |
1.0.1.73 | 2,916 | 7/31/2011 |
1.0.1.71 | 2,008 | 7/31/2011 |
1.0.1.69 | 2,089 | 5/26/2011 |
1.0.1.68 | 2,131 | 5/25/2011 |
1.0.1.67 | 2,168 | 5/18/2011 |
1.0.1.66 | 2,080 | 5/18/2011 |
1.0.1.63 | 2,216 | 3/28/2011 |
1.0.1.62 | 2,200 | 3/17/2011 |
1.0.1.60 | 58,170 | 2/24/2011 |