Fluent.Unions.Shouldly
1.1.0
dotnet add package Fluent.Unions.Shouldly --version 1.1.0
NuGet\Install-Package Fluent.Unions.Shouldly -Version 1.1.0
<PackageReference Include="Fluent.Unions.Shouldly" Version="1.1.0" />
<PackageVersion Include="Fluent.Unions.Shouldly" Version="1.1.0" />
<PackageReference Include="Fluent.Unions.Shouldly" />
paket add Fluent.Unions.Shouldly --version 1.1.0
#r "nuget: Fluent.Unions.Shouldly, 1.1.0"
#:package Fluent.Unions.Shouldly@1.1.0
#addin nuget:?package=Fluent.Unions.Shouldly&version=1.1.0
#tool nuget:?package=Fluent.Unions.Shouldly&version=1.1.0
![]()
Fluent.Unions.Shouldly
Adds ShouldBeOk, ShouldBeError, ShouldBeSome and ShouldBeNone for Result, Result<T> and Option<T> to Shouldly. The methods return the value or the error, so a test can continue, and a failure message names the actual state.
Installation
dotnet add package Fluent.Unions.Shouldly
Usage
using Shouldly;
using Fluent.Unions.Shouldly;
Result<Order> placed = await orders.PlaceAsync(request);
placed.ShouldBeOk().Total.ShouldBe(49.90m);
// passes when the order was placed with that total
Result missing = await orders.DeleteAsync(unknownId);
missing.ShouldBeError<NotFoundException>().Message.ShouldContain("was not found");
// passes when the error is a NotFoundException
customer.Nickname.ShouldBeNone();
// passes when the customer has no nickname
With your own result type
ShouldBeOk() and ShouldBeError() accept a result type you declare with [FluentResult<TError>], with a value and without (the value-less Result), and fail with the same messages. ShouldBeError() returns your declared error type. When that is an error union, ShouldBeError<NotFound>() returns the case, and fails for another case. 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)
- Shouldly (>= 4.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.