Fluent.Unions.NUnit
1.1.0
dotnet add package Fluent.Unions.NUnit --version 1.1.0
NuGet\Install-Package Fluent.Unions.NUnit -Version 1.1.0
<PackageReference Include="Fluent.Unions.NUnit" Version="1.1.0" />
<PackageVersion Include="Fluent.Unions.NUnit" Version="1.1.0" />
<PackageReference Include="Fluent.Unions.NUnit" />
paket add Fluent.Unions.NUnit --version 1.1.0
#r "nuget: Fluent.Unions.NUnit, 1.1.0"
#:package Fluent.Unions.NUnit@1.1.0
#addin nuget:?package=Fluent.Unions.NUnit&version=1.1.0
#tool nuget:?package=Fluent.Unions.NUnit&version=1.1.0
![]()
Fluent.Unions.NUnit
Adds constraints for the state of a Result, Result<T> and Option<T> to NUnit: IsResult.Ok, IsResult.Error and IsOption.Some, among others. A failure message names the actual state. It targets NUnit 4 and later.
Installation
dotnet add package Fluent.Unions.NUnit
Usage
using Fluent.Unions.NUnit;
Result<Order> placed = await orders.PlaceAsync(request);
Assert.That(placed, IsResult.OkWith(Has.Property("Total").EqualTo(49.90m)));
// passes when the order was placed with that total
Result missing = await orders.DeleteAsync(unknownId);
Assert.That(missing, IsResult.ErrorOfType<NotFoundException>());
// passes when the error is a NotFoundException
Assert.That(customer.Nickname, IsOption.None);
// passes when the customer has no nickname
With your own result type
The IsResult constraints recognize a result type you declare with [FluentResult<TError>]. An error that is not an exception prints as failed with Type: .... IsResult.ErrorOfType<TError>() and IsResult.ErrorWith(...) also look inside an error union, so ErrorOfType<NotFound>() passes for an AppError that holds a NotFound. See Your own Result type.
Documentation
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Fluent.Unions (>= 1.1.0)
- NUnit (>= 4.6.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.