.N .NET Landscape

FluentAssertions

Testing
github.com/fluentassertions/fluentassertions

A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit tests. Targets .NET Framework 4.7, as well as .NET Core 2.1, .NET Core 3.0, .NET 6, .NET Standard 2.0 and 2.1. Supports the unit test frameworks MSTest2, NUnit3, XUnit2, MSpec, and NSpec3.

$ Commercial licence. From v8 a paid Xceed licence is required for commercial use; v7 stays Apache-2.0. Licensing changes often; verify on the project's site before adopting.

assertionsbdd-stylec-sharpfluent-assertionshacktoberfestmstesttddunit-testingxunit
GitHub stars
3,813
Forks
720
Open issues
77
NuGet downloads
800,934,046
latest 8.11.0
Language
C#
Last push
today
24 Oct 2026
Created
28 Jul 2013


Extension methods to fluently assert the outcome of .NET tests

Coveralls branch qodana GitHub Repo stars GitHub contributors GitHub last commit GitHub commit activity open issues

About • Download • How To Use • Building • Contributing • Versioning •

About

Fluent Assertions offers a comprehensive suite of extension methods that enable developers to naturally express the expected outcomes of TDD (Test-Driven Development) or BDD (Behavior-Driven Development) unit tests. By providing a more readable and intuitive approach to writing assertions, it streamlines the testing process and improves code clarity. It supports a wide range of .NET platforms, including .NET Framework 4.7, .NET Core 2.1, 3.0, and 6, as well as .NET Standard 2.0 and 2.1, ensuring compatibility across various modern development environments.

Xceed Partnership

Originally authored by Dennis Doomen with Jonas Nyrup as the productive side-kick. Xceed is now an official Partner to Fluent Assertions! Learn what this partnership means for our users. After extensive discussions with the Fluent Assertions team, we are thrilled about the future of the product and look forward to its continued growth and development.

Download

This library is available as a NuGet package on https://nuget.org. To install it, use the following command-line:

dotnet add package FluentAssertions

How do I use it

Fluent Assertions contains a tremendous amount of assertion methods that will make your unit tests easier to read and give you as much information possible upon failure. Consider this example.

IEnumerable<int> numbers = new[] { 1, 2, 3 };

numbers.Should().OnlyContain(n => n > 0);
numbers.Should().HaveCount(4, "because we thought we put four items in the collection");

This should give you the following failure:

Expected numbers to contain 4 item(s) because we thought we put four items in the collection, but found 3.

Visit https://www.fluentassertions.com for background information, usage documentation, an extensibility guide, support information and more tips & tricks.

Building

Install Visual Studio 2026 18.0+ or JetBrains Rider 2025.3. You will also need to have .NET Framework 4.7 SDK and .NET 10.0 SDK installed. Check the global.json for the current minimum required version.

You can also build, run the unit tests and package the code using the following command-line:

build.ps1

Or, if you have, the Fallout tool installed:

fallout

Also try using --help to see all the available options or --plan to see what the scripts does.

What are these Approval.Tests?

This is a special set of tests that use the Verify project to verify whether you've introduced any breaking changes in the public API of the library.

If you've verified the changes and decided they are valid, you can accept them using AcceptApiChanges.ps1 or AcceptApiChanges.sh. Alternatively, you can use the Verify Support plug-in to compare the changes and accept them right from inside Rider. See also the Contribution Guidelines.

Contributing

Your contributions are always welcome! Please have a look at the contribution guidelines first.

Versioning

This library uses Semantic Versioning to give meaning to the version numbers. For the versions available, see the tags on this repository.

Credits

This library wouldn't have been possible without the following tools, packages and companies:

Powered By

License

Versions 8 and beyond are free for open-source projects and non-commercial use, but commercial use requires a paid license. Check out the license page for more information.

Version 7 will remain fully open-source indefinitely and receive bugfixes and other important corrections.