Fluent.Unions.TUnit 1.1.0

dotnet add package Fluent.Unions.TUnit --version 1.1.0
                    
NuGet\Install-Package Fluent.Unions.TUnit -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.TUnit" 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.TUnit" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Fluent.Unions.TUnit" />
                    
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.TUnit --version 1.1.0
                    
#r "nuget: Fluent.Unions.TUnit, 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.TUnit@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.TUnit&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Fluent.Unions.TUnit&version=1.1.0
                    
Install as a Cake Tool

Fluent.Unions

Fluent.Unions.TUnit

NuGet Downloads Publish Documentation

Adds IsOk, IsError, IsSome and IsNone for Result, Result<T> and Option<T> to TUnit assertions. Awaiting an assertion returns the value or the error, and a failure message names the actual state.

Installation

dotnet add package Fluent.Unions.TUnit

Usage

using TUnit.Assertions.Extensions;

Result<Order> placed = await orders.PlaceAsync(request);
Order order = await Assert.That(placed).IsOk();
// passes when the order was placed, and returns it

Result missing = await orders.DeleteAsync(unknownId);
NotFoundException error = await Assert.That(missing).IsError<NotFoundException>();
// passes when the error is a NotFoundException, and returns it

await Assert.That(customer.Nickname).IsNone();
// passes when the customer has no nickname

The extension methods are generated into TUnit.Assertions.Extensions, which TUnit projects import globally. The package depends on TUnit.Assertions only, so the assertions also work in a test project of another framework.

With your own result type

Assert a result type you declare with [FluentResult<TError>] through AsResult(). C# does not allow the result interface as a type argument, so the generated assertions cannot take your type directly. The default types keep Assert.That(result).IsOk(). See Your own Result type.

await Assert.That(result.AsResult()).IsOk();
await Assert.That(result.AsResult()).IsError();
NotFound notFound = await Assert.That(result.AsResult().ErrorCase<NotFound>()).IsSome(); // a case of an error union

The assertion methods behind Assert.That(...) are not public extensions, so result.IsOk(); does not compile instead of asserting nothing.

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 91 11/22/2026
1.0.0 91 11/21/2026
0.3.0 90 11/20/2026