MrKWatkins.Assertions 1.4.0

Prefix Reserved
dotnet add package MrKWatkins.Assertions --version 1.4.0
                    
NuGet\Install-Package MrKWatkins.Assertions -Version 1.4.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MrKWatkins.Assertions" Version="1.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MrKWatkins.Assertions" Version="1.4.0" />
                    
Directory.Packages.props
<PackageReference Include="MrKWatkins.Assertions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MrKWatkins.Assertions --version 1.4.0
                    
#r "nuget: MrKWatkins.Assertions, 1.4.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MrKWatkins.Assertions@1.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MrKWatkins.Assertions&version=1.4.0
                    
Install as a Cake Addin
#tool nuget:?package=MrKWatkins.Assertions&version=1.4.0
                    
Install as a Cake Tool

MrKWatkins.Assertions

Build Status NuGet Version NuGet Downloads

A fluent assertion library for .NET unit testing.

Installation

dotnet add package MrKWatkins.Assertions

Everything is in the MrKWatkins.Assertions namespace:

using MrKWatkins.Assertions;

Quick Start

Call .Should() on any value to begin a fluent assertion:

// Equality
42.Should().Equal(42);
"hello".Should().Equal("hello");

// Null checks
string? value = null;
value.Should().BeNull();

// Collections
var numbers = new[] { 1, 2, 3 };
numbers.Should().SequenceEqual(1, 2, 3);
numbers.Should().Contain(2);

// Strings
"Hello, World!".Should().StartWith("Hello").And.Contain("World");

// Exceptions
(() => throw new InvalidOperationException("oops"))
    .Should().Throw<InvalidOperationException>()
    .WithMessage("oops");

Chaining

Most assertions return a chain object that lets you keep asserting on the same value:

"hello world"
    .Should()
    .NotBeNull()
    .And.StartWith("hello")
    .And.EndWith("world")
    .And.HaveLength(11);

Documentation

Find the full documentation at https://mrkwatkins.github.io/Assertions/.

Why?

FluentAssertions recently moved to a paid licence model with version 8.0. Whilst I don't have a particular problem with that, I am slightly annoyed by how they did it. Instead of making a new package, they simply upgraded the version number and changed the licence. Which means any processes you might have in place to automatically upgrade packages would then upgrade them and potentially leave you open to licencing costs. And yes, of course you should check your upgrades, blah blah, but I would counter that with you shouldn't change licences on projects like that! Start a new package. Or something else. Whatever. Be better.

Anyway, it annoyed me enough that I thought I'd have a crack at my own version for a challenge and to see if I can fix a few irritations I have with FluentAssertions on the way, such as:

  • No Span support.
  • Default ordering is not strict.

As such, this is purely designed for use in my other projects. If you want to use it, go for it, but don't expect me to fix bugs or add features anytime soon.

Contributing, PRs, etc.

Not accepting contributions or PRs at the current time, as it's just a project for my own amusement and to support my other projects. Feel free to submit issues, just don't expect me to look at them with any sense of urgency.

Licence

MIT. And I won't change it. Honest.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MrKWatkins.Assertions:

Package Downloads
MrKWatkins.OakAsm.Testing

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.0 575 2/24/2026
1.3.2 98 2/23/2026
1.3.1 108 2/23/2026
1.3.0 193 2/21/2026
1.2.0 177 2/20/2026
1.1.0 114 2/19/2026
1.0.0 207 2/15/2026
0.0.21 1,126 1/29/2025
0.0.20 128 1/29/2025
0.0.19 152 1/29/2025
0.0.18 153 1/29/2025
0.0.17 152 1/26/2025
0.0.16 154 1/25/2025
0.0.15 153 1/23/2025
0.0.14 150 1/21/2025
0.0.13 138 1/20/2025
0.0.12 166 1/20/2025
0.0.11 146 1/20/2025
0.0.10 144 1/20/2025
0.0.9 152 1/20/2025
Loading failed