CSharpFunctionalExtensions.FluentAssertions 3.0.0-prerelease-13-1

This is a prerelease version of CSharpFunctionalExtensions.FluentAssertions.
dotnet add package CSharpFunctionalExtensions.FluentAssertions --version 3.0.0-prerelease-13-1                
NuGet\Install-Package CSharpFunctionalExtensions.FluentAssertions -Version 3.0.0-prerelease-13-1                
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="CSharpFunctionalExtensions.FluentAssertions" Version="3.0.0-prerelease-13-1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CSharpFunctionalExtensions.FluentAssertions --version 3.0.0-prerelease-13-1                
#r "nuget: CSharpFunctionalExtensions.FluentAssertions, 3.0.0-prerelease-13-1"                
#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.
// Install CSharpFunctionalExtensions.FluentAssertions as a Cake Addin
#addin nuget:?package=CSharpFunctionalExtensions.FluentAssertions&version=3.0.0-prerelease-13-1&prerelease

// Install CSharpFunctionalExtensions.FluentAssertions as a Cake Tool
#tool nuget:?package=CSharpFunctionalExtensions.FluentAssertions&version=3.0.0-prerelease-13-1&prerelease                

CSharpFunctionalExtensions.FluentAssertions

  • NuGet Package CSharpFunctionalExtensions.FluentAssertions

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

Star History

<a href="https://star-history.com/#NitroDevs/CSharpFunctionalExtensions.FluentAssertions&Date"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=NitroDevs/CSharpFunctionalExtensions.FluentAssertions&type=Date&theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=NitroDevs/CSharpFunctionalExtensions.FluentAssertions&type=Date" /> <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=NitroDevs/CSharpFunctionalExtensions.FluentAssertions&type=Date" /> </picture> </a>

Learn More

Dependencies

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

CSharpFunctionalExtensons >= 2.37.0

FluentAssertions >= 6.10.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<string> 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<string>("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<int, Exception>(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<int, Exception>(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<string>();

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 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

Zafiro.FileSystem.Actions

Turns your filesystem problems into a breadcrumb

GitHub repositories (1)

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

Repository Stars
KyleMcMaster/payroll-processor
A smorgasbord of modern .NET tech written with functional and asynchronous patterns
Version Downloads Last updated
3.0.0-prerelease-13-1 95 4/14/2024
2.0.0 43,242 8/11/2023
2.0.0-prerelease-12-1 70 4/14/2024
2.0.0-prerelease-11-1 455 8/11/2023
2.0.0-prerelease-10-1 666 5/18/2023
1.1.0 28,662 11/19/2022
1.1.0-prerelease-9-1 522 11/19/2022
1.0.1-prerelease-8-1 503 11/2/2022
1.0.0 1,019 10/21/2022
1.0.0-prerelease-7-1 527 10/21/2022
1.0.0-prerelease-6-1 503 10/9/2022
1.0.0-prerelease-5-1 510 8/26/2022
1.0.0-prerelease-4-1 506 8/13/2022
1.0.0-prerelease-3-1 547 4/29/2022
1.0.0-prerelease-2-1 561 4/16/2022