Skip to main content

aweXpect

Nuget Nuget

aweXpect is a fluent assertion library for .NET. It turns test verifications into readable sentences and produces failure messages that explain in plain English what was expected and what actually happened.

await Expect.That(message).IsEqualTo("It's a compliment");
Expected that message
is equal to "It's a compliment",
but it was "It's a complement" which differs at index 12:
↓ (actual)
"It's a complement"
"It's a compliment"
↑ (expected)

Why aweXpect?

Every expectation is awaited. The same fluent chain works for sync values, Task, IAsyncEnumerable, exceptions and HTTP responses - there is no parallel …Async() API to remember.

// Plain value
await Expect.That(result).IsEqualTo(42);

// Task<T>
await Expect.That(_users.GetAsync(id))
.Satisfies(u => u.IsActive);

// IAsyncEnumerable<T> - the cancellation token flows through the stream
await Expect.That(_orders.StreamAsync())
.Contains(o => o.IsPriority)
.WithCancellation(cancellationToken);

// Delegate that throws
await Expect.That(() => _payments.ChargeAsync(-1m))
.ThrowsExactly<ArgumentOutOfRangeException>();

Because the chain is awaited, Because(...) and WithCancellation(...) attach once at the end instead of being threaded through every method. Multiple expectations compose directly via Expect.ThatAll(...) - no thread-static assertion scope.

Migrating from another assertion library?

The aweXpect.Migration analyzer ships code-fix providers that rewrite most FluentAssertions and xunit.Assert call sites for you. See the migration guide for the full walkthrough.

Companion libraries

aweXpect ships a small core with focused extensions for common ecosystems:

Where to go next

  • Getting Started - install the package and write your first expectation.
  • Migration - automated code fixes for moving from FluentAssertions or xunit.Assert.
  • Advanced - multiple expectations, cancellation, customization, and more.
  • Write your own extension - add expectations for your own types using aweXpect.Core.