CSharpFunctionalExtensions.FluentAssertions 3.6.0

dotnet add package CSharpFunctionalExtensions.FluentAssertions --version 3.6.0
                    
NuGet\Install-Package CSharpFunctionalExtensions.FluentAssertions -Version 3.6.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.

                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.

                    
Directory.Packages.props

                    
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 CSharpFunctionalExtensions.FluentAssertions --version 3.6.0
                    
#r "nuget: CSharpFunctionalExtensions.FluentAssertions, 3.6.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 CSharpFunctionalExtensions.FluentAssertions@3.6.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=CSharpFunctionalExtensions.FluentAssertions&version=3.6.0
                    
Install as a Cake Addin
#tool nuget:?package=CSharpFunctionalExtensions.FluentAssertions&version=3.6.0
                    
Install as a Cake Tool

CSharpFunctionalExtensions.FluentAssertions

  • NuGet Package CSharpFunctionalExtensions.FluentAssertions

A small set of extensions to make test assertions more fluent when using CSharpFunctionalExtensions! Wow!

Star History

Star History Chart

Learn More

Dependencies

This library is compatible with .NET 6+. It requires the following minimum package versions:

CSharpFunctionalExtensons >= 3.0.0

FluentAssertions >= 7.2.0

Installation

This library is available on Nuget and can be installed with the .NET CLI using the following command:

dotnet add package CSharpFunctionalExtensions.FluentAssertions

Usage

Maybe Assertions

var maybe = Maybe.From("foo");

maybe.Should().HaveSomeValue(); // passes
maybe.Should().HaveValue("foo"); // passes
maybe.Should().HaveValue("bar"); // throws
maybe.Should().HaveNoValue(); // throws
Maybe maybe = null;

maybe.Should().HaveNoValue(); // passes
maybe.Should().HaveValue("foo"); // throws

Result Assertions

var result = Result.Success();

result.Should().Succeed(); // passes
result.Should().Fail() // throws
var result = Result.Failure("error");

result.Should().Fail() // passes
result.Should().FailWith("error"); // passes
result.Should().FailWith("some other error"); // throws
result.Should().Succeed(); // throws

Generic Result of T Assertions

var result = Result.Success(420);

result.Should().Succeed(); // passes
result.Should().SucceedWith(420); // passes
result.Should().SucceedWith(69); // throws
result.Should().Fail(); // throws
var result = Result.Failure("error");

result.Should().Fail() // passes
result.Should().FailWith("error"); // passes
result.Should().FailWith("some other error"); // throws
result.Should().Succeed(); // throws

Generic Result of T:Value and E:Error Assertions

var result = Result.Success(420);

result.Should().Succeed(); // passes
result.Should().SucceedWith(420); // passes
result.Should().SucceedWith(69); // throws
result.Should().Fail(); // throws
result.Should().FailWith(new Exception("error")); // throws
var result = Result.Failure(new Exception("error"));

result.Should().Fail(); // passes
result.Should().FailWith(new Exception("error")); // passes
result.Should().FailWith(new Exception("some other error")); // throws
result.Should().Succeed(); // throws
result.Should().SucceedWith(4680); // throws

UnitResult Assertions

var result = UnitResult.Success();

result.Should().Succeed(); // passes
result.Should().Fail(); // throws
result.Should().FailWith("error"); // throws
var result = UnitResult.Failure("error");

result.Should().Fail(); // passes
result.Should().FailWith("error"); // passes
result.Should().Succeed(); // throws

Acknowledgements

Special thanks to Sean Wright for all his guidance and contributions over the design, development, and release of this project. His insights are invaluable! 😄

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on CSharpFunctionalExtensions.FluentAssertions:

Package Downloads
Hopex.ApplicationServer.Commons

Hopex Application Server Commons

Zafiro.FileSystem.VNext

Turns your filesystem problems into a breadcrumb

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on CSharpFunctionalExtensions.FluentAssertions:

Repository Stars
SuperJMN/DotnetPackaging
Distribute your .NET applications!
KyleMcMaster/payroll-processor
A smorgasbord of modern .NET tech written with functional and asynchronous patterns
Version Downloads Last Updated
3.6.0 31,465 10/4/2025
3.6.0-prerelease-18-1 150 10/4/2025
3.0.0 23,274 4/9/2025
3.0.0-prerelease-17-1 161 10/4/2025
3.0.0-prerelease-16-1 283 4/9/2025
3.0.0-prerelease-13-1 1,154 4/14/2024
2.0.0 217,787 8/11/2023
2.0.0-prerelease-12-1 242 4/14/2024
2.0.0-prerelease-11-1 651 8/11/2023
2.0.0-prerelease-10-1 2,101 5/18/2023
1.1.0 50,683 11/19/2022
1.1.0-prerelease-9-1 742 11/19/2022
1.0.1-prerelease-8-1 731 11/2/2022
1.0.0 1,419 10/21/2022
1.0.0-prerelease-7-1 752 10/21/2022
1.0.0-prerelease-6-1 708 10/9/2022
1.0.0-prerelease-5-1 743 8/26/2022
1.0.0-prerelease-4-1 726 8/13/2022
1.0.0-prerelease-3-1 796 4/29/2022
1.0.0-prerelease-2-1 815 4/16/2022