Covers the FluentAssertions v8 move to a commercial Xceed licence, the AwesomeAssertions fork, Shouldly, built-in xUnit/NUnit/MSTest asserts, structural equivalence, failure-message quality and how to choose and migrate.
As of November 2026: FluentAssertions 8, released in January 2025, moved from Apache 2.0 to a commercial Xceed licence. Commercial use needs a paid per-developer licence; it is free only for non-commercial and open-source work. Version 7.x stays Apache 2.0 and gets critical fixes only. The community answer was AwesomeAssertions, an Apache 2.0 fork that is close to a namespace rename.
For a new commercial project I'd pick one of:
Assert.Equal, xUnit's Assert.Equivalent, available since xUnit 2.5 and in v3): no extra dependency, good enough messages.ShouldBe/Should().Be() and excellent diffs for objects and collections.The trade-off is readability and diff quality versus another dependency with licence risk and an uncertain maintenance future. Whatever you choose, pin the major version so a bot can't upgrade you into a paid licence.
"An assertion library has one job: when a test fails, tell me exactly what was different, fast. The framework asserts like xUnit's
Assert.Equaldo that well for simple values, and xUnit now hasAssert.Equivalentfor comparing object graphs by their properties. Libraries like FluentAssertions became popular because the syntax reads like a sentence and the failure messages for collections and objects were excellent.The landscape changed in January 2025. FluentAssertions version 8 was released under a commercial licence after a partnership with Xceed. It's free for open-source and non-commercial use, but a company using it needs a paid licence per developer. Version 7 stays on Apache 2.0 and only gets critical fixes. The community forked the last open code into AwesomeAssertions, which keeps the same fluent API under Apache 2.0, so migrating is mostly a package and namespace swap. Shouldly is the other popular option, with a
result.ShouldBe(expected)style and good messages that include the expression text.How I decide: first, licence risk. A Dependabot PR that bumps FluentAssertions from 7 to 8 silently creates a compliance problem, so I either pin with Central Package Management or move off it. Second, failure-message quality on the things we compare most, which in APIs is usually DTOs and collections. Third, fewer dependencies is better. For a new service I'm happy with built-in asserts plus
Assert.Equivalent, and Verify for big payloads. The mistake I see is choosing on syntax taste; the real costs are licences and unreadable failures."
| Library | Licence | Style | Notes |
|---|---|---|---|
| FluentAssertions 8.x | Xceed commercial (free non-commercial) | x.Should().Be(y) |
Paid per developer for commercial use |
| FluentAssertions 7.x | Apache 2.0 | same | Critical fixes only, no new features |
| AwesomeAssertions | Apache 2.0 | same | Community fork; namespace AwesomeAssertions |
| Shouldly | Permissive open source | x.ShouldBe(y) |
Messages show the source expression |
xUnit Assert |
Apache 2.0 | Assert.Equal(y, x) |
Assert.Equivalent for object graphs |
NUnit Assert.That |
MIT | Assert.That(x, Is.EqualTo(y)) |
Rich constraint model |
| Verify | MIT | snapshot | Best for large outputs, not small values |
| Situation | Choice |
|---|---|
| Existing suite on FA 7, commercial | Pin to 7.x now; plan a move to AwesomeAssertions |
| Existing suite on FA 8, commercial | Buy licences or migrate; don't ignore it |
| New service, small team | Built-in asserts + Assert.Equivalent |
| Heavy object and collection comparison | AwesomeAssertions or Shouldly |
| Large JSON or HTML outputs | Verify snapshots |
A consultancy found 14 client repositories had been auto-upgraded to FluentAssertions 8 by Dependabot over three months. Licence scanning flagged it during a client audit. They pinned to 7.x through Central Package Management in a day, then moved to AwesomeAssertions with a scripted namespace replace; 9,000 tests passed unchanged apart from 12 that relied on removed APIs.
Checks awareness of recent ecosystem changes and whether the candidate weighs licence risk and failure diagnostics, not just syntax.
Green flags
Red flags
Assert.True(a == b) style assertionsAn assertion is a method that throws an exception when a condition is false. The framework catches it, marks the test failed and prints the message:
test method
|-- Act
|-- Assert -> condition false -> throw XunitException(message)
|
runner catches -> test failed + message + stack trace
Every library is just a different way of building that message. Quality differences come from how well it describes the difference (which property, which index, expected versus actual).
Comparing two DTOs with Assert.Equal uses Equals. Records get value equality for free; classes don't. Equivalence assertions walk both object graphs by reflection and compare member by member:
expected.Customer.Address.Postcode = "2000"
actual.Customer.Address.Postcode = "2001" <- reported path
xUnit's Assert.Equivalent(expected, actual, strict: false) ignores extra members on actual unless strict is true. FluentAssertions / AwesomeAssertions BeEquivalentTo lets you exclude members and control ordering.
Test dependencies aren't shipped to customers, but licences apply to use, not only distribution. A commercial licence that is required "for commercial use" covers your developers running tests on company machines and CI. Licence scanners (GitHub dependency review, Snyk, Mend) flag these packages, and audits ask about them.
A fork such as AwesomeAssertions starts from the last Apache 2.0 commit, so the API is almost identical. Migration is usually: swap the package, replace using FluentAssertions;, fix the few APIs that diverged. Over time forks drift, so read release notes before assuming a drop-in.
With Central Package Management (Directory.Packages.props) you set the version once. A Dependabot ignore rule for major versions stops the bot proposing a 7 to 8 jump.
Assert.Equal and with Assert.Equivalent; read both failure messages.Directory.Packages.props to a solution and pin your assertion library.ignore rule for major versions of that package.dotnet list package --include-transitive and look for any package whose licence you don't know.The same test with built-in xUnit asserts and with Shouldly, plus version pinning:
// QuoteService.cs (code under test)
namespace Shop.Quotes;
public sealed class QuoteLine(string sku, int quantity, decimal unitPrice)
{
public string Sku { get; } = sku;
public int Quantity { get; } = quantity;
public decimal UnitPrice { get; } = unitPrice;
}
public sealed class Quote(string customer, IReadOnlyList<QuoteLine> lines)
{
public string Customer { get; } = customer;
public IReadOnlyList<QuoteLine> Lines { get; } = lines;
public decimal Total => Lines.Sum(l => l.Quantity * l.UnitPrice);
}
public static class QuoteService
{
public static Quote Create(string customer) =>
new(customer, [new QuoteLine("SKU-1", 2, 10m), new QuoteLine("SKU-2", 1, 5.5m)]);
}
// QuoteServiceTests.cs (xunit.v3 + Shouldly)
using Shop.Quotes;
using Shouldly;
using Xunit;
namespace Shop.Quotes.Tests;
public sealed class QuoteServiceTests
{
[Fact]
public void Built_in_equivalent_compares_by_members()
{
var quote = QuoteService.Create("Acme");
// Quote is a class without value equality, so Assert.Equal would compare references.
Assert.Equivalent(
new { Customer = "Acme", Lines = new[] { new { Sku = "SKU-1", Quantity = 2 }, new { Sku = "SKU-2", Quantity = 1 } } },
quote);
Assert.Equal(25.5m, quote.Total);
}
[Fact]
public void Shouldly_reads_naturally()
{
var quote = QuoteService.Create("Acme");
quote.Customer.ShouldBe("Acme");
quote.Lines.Select(l => l.Sku).ShouldBe(["SKU-1", "SKU-2"]);
quote.Total.ShouldBe(25.5m);
}
}
<!-- Directory.Packages.props: pin versions so a bot cannot jump a licence boundary -->
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="xunit.v3" Version="4.0.0" />
<PackageVersion Include="Shouldly" Version="4.3.0" />
<!-- If you must stay on FluentAssertions for now: the last Apache 2.0 line. -->
<PackageVersion Include="FluentAssertions" Version="[7.2.0, 8.0.0)" />
</ItemGroup>
</Project>
[7.x, 8.0.0) or migrate to AwesomeAssertions, Shouldly or built-in asserts.Assert.Equal on classes without value equality. Why it is wrong: It compares references and fails with a useless message. Instead: Use records, Assert.Equivalent, or an equivalence assertion.Assert.True(a == b). Why it is wrong: The failure message just says "expected True". Instead: Use Assert.Equal(expected, actual) so the message shows both values.Assert.Equal. Why it is wrong: Failure messages become misleading. Instead: Expected first in xUnit, or use a fluent style where the order is obvious.Assertion libraries are a low-value, high-churn dependency: they improve readability but rarely change what you can test. After the FluentAssertions licence change I treat them like any other third-party dependency: check the licence, pin the major version and prefer fewer packages. Built-in asserts have caught up enough (Assert.Equivalent, collection asserts, Assert.Multiple in xUnit and NUnit) that many teams no longer need a library.
| Option | When it fits | Cost | When not to |
|---|---|---|---|
| Built-in asserts | New projects, minimal dependencies | Slightly less readable | Heavy graph comparisons with exclusions |
| AwesomeAssertions | Migrating from FluentAssertions | Fork may diverge; smaller team | When you'd rather drop the dependency |
| Shouldly | Readable assertions, good messages | Different API to learn | Suites already on the fluent Should() style |
| FluentAssertions 8 + licence | Teams happy to pay for support | Per-developer cost, procurement | Projects with no budget or procurement path |
Measure by reading real failure messages from CI: if a developer can't tell what broke without re-running locally, the assertions aren't doing their job.
Use snapshot testing when the output is large or structured and you care about all of it: an API response, a generated email, source generator output, an OpenAPI document. Verify serialises the result to a .verified.txt file that is committed with the code. On the next run it compares the new output and, if anything differs, writes a .received.txt file, fails the test and shows a diff.
Verify scrubs volatile values such as Guids and dates by default. When a change is intended, you review the diff and accept it, and the updated snapshot is reviewed again in the pull request.
I keep explicit assertions for the one or two values that are the business rule, such as "GST is 10%". The trade-off is that snapshots replace a lot of assertion code, but if people accept them without reading, they only detect change. They stop checking correctness.
A NuGet package version is immutable, so a licence can only change when you take a new version. The job is to control which versions get in:
Directory.Packages.props) puts every version in one file that gets reviewed, and lock files pin transitive packages too.ignore rules for major versions of sensitive packages. Majors are where licences change: FluentAssertions 8 moved to a paid commercial licence in January 2025.allow-licenses, or the nuget-license tool, against an allow-list. It also fails on unknown licences.Test and build packages get the same review as production ones. The trade-off is some friction on every upgrade, in exchange for never finding a commercial licence during an audit.
Last updated 23 Nov 2026.