Fluent.Unions.FluentAssertions 1.1.0

dotnet add package Fluent.Unions.FluentAssertions --version 1.1.0
                    
NuGet\Install-Package Fluent.Unions.FluentAssertions -Version 1.1.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="Fluent.Unions.FluentAssertions" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fluent.Unions.FluentAssertions" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Fluent.Unions.FluentAssertions" />
                    
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 Fluent.Unions.FluentAssertions --version 1.1.0
                    
#r "nuget: Fluent.Unions.FluentAssertions, 1.1.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 Fluent.Unions.FluentAssertions@1.1.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=Fluent.Unions.FluentAssertions&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Fluent.Unions.FluentAssertions&version=1.1.0
                    
Install as a Cake Tool

Fluent.Unions

Fluent.Unions.FluentAssertions

NuGet Downloads Publish Documentation

Adds Should() for Result, Result<T> and Option<T> to FluentAssertions version 8. It builds on Fluent.Unions, and a failure message names the actual state.

License notice. FluentAssertions version 8 and later is commercial software from Xceed. It is free for open-source projects and non-commercial use, and commercial use requires a paid license. This package itself stays under the license of Fluent.Unions, but it depends on FluentAssertions 8. For commercial work without a FluentAssertions license, use Fluent.Unions.AwesomeAssertions, which has the same assertions for AwesomeAssertions (Apache-2.0).

Installation

dotnet add package Fluent.Unions.FluentAssertions

Usage

Assert on an Ok result and its value.

using FluentAssertions;
using Fluent.Unions.FluentAssertions;

Result<Order> placed = await orders.PlaceAsync(request);
placed.Should().BeOk().Which.Total.Should().Be(49.90m);

Assert on the exception inside an error. * and ? are wildcards in the message pattern.

Result<Order> missing = await orders.FindAsync(unknownId);
missing.Should().BeError<NotFoundException>().WithMessage("Order * was not found");

Assert on an option.

Option<string> nickname = customer.Nickname;
nickname.Should().BeSomeWithValue("ada");

Assert on the inner exceptions of an aggregate error, such as the output of Validate.

registered.Should().BeAggregateError().WithInnerCount(2);

With your own result type

Should() works on a result type you declare with [FluentResult<TError>] when it has a value. There are no assertions for the value-less Result of your own type. BeError<TCase>() also matches a case inside an error union. See Your own Result type.

StockResult<Reservation> reserved = await stock.ReserveAsync(sku, quantity);
reserved.Should().BeError<OutOfStock>().Which.Sku.Should().Be("KB-1");

A default result counts as an error, so BeError() passes for it and BeOk() fails.

Documentation

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 102 11/22/2026
1.0.0 104 11/21/2026
0.3.0 103 11/20/2026