OmniAssert 2.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package OmniAssert --version 2.2.0
                    
NuGet\Install-Package OmniAssert -Version 2.2.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.
<PackageReference Include="OmniAssert" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OmniAssert" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="OmniAssert" />
                    
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 OmniAssert --version 2.2.0
                    
#r "nuget: OmniAssert, 2.2.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 OmniAssert@2.2.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=OmniAssert&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=OmniAssert&version=2.2.0
                    
Install as a Cake Tool

<div align="center"> <img src="https://raw.githubusercontent.com/bolorundurowb/OmniAssert/refs/heads/master/assets/omni-assert-logo.svg" alt="omni assert logo" /> <h1 align="center">Omni Assert</h1> </div>

<p align="center"> <a href="https://github.com/bolorundurowb/OmniAssert/actions/workflows/build-and-test.yml"> <img src="https://github.com/bolorundurowb/OmniAssert/actions/workflows/build-and-test.yml/badge.svg" alt="Build, Test & Coverage" /> </a> <a href="https://codecov.io/gh/bolorundurowb/OmniAssert"> <img src="https://codecov.io/gh/bolorundurowb/OmniAssert/graph/badge.svg?token=J9ssbN9xYA" alt="codecov" /> </a> <a href="./LICENSE"> <img src="https://img.shields.io/badge/license-GPLv3-orange.svg" alt="License" /> </a> </p>

OmniAssert is a fluent assertion library for .NET 10 and C# 14. Tests read like plain English and failures show the expression under test, actual values, and optional compile-time operand capture.

Built with substantial AI assistance. Review the implementation before use in security-sensitive or compliance-heavy environments.

Documentation

Full documentation — API reference, soft assertions, object diffing, interceptors, analyzer rules (OA001–OA007), v1 → v2 migration, and Extensions.

Key features

  • Fluent APIuser.Email.Must().Contain("@") reads naturally across strings, numbers, collections, objects, exceptions, files, dates, spans, and nullable values
  • Deep object comparisonBeEquivalentTo compares object graphs recursively with hierarchical diffs
  • Soft assertionsAssertionScope collects multiple failures and reports them together
  • Compile-time diagnostics — optional Roslyn interceptors capture operand values when boolean expressions fail

Quick start

<ItemGroup>
  <PackageReference Include="OmniAssert" Version="2.2.0" />
  
  <PackageReference Include="OmniAssert.Extensions" Version="2.2.0" />
</ItemGroup>
using OmniAssert;
using OmniAssert.Extensions.Web; // when using Extensions

user.Id.Must().BeGreaterThan(0);
user.Email.Must().BeEmailAddress();
(() => Service.Create(badInput)).Throws<ArgumentException>();

Contributing

See CONTRIBUTING.md.

License

GNU General Public License v3.0 — see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on OmniAssert:

Package Downloads
OmniAssert.Extensions

Domain-specific fluent assertions for web, financial, security, and regional validation — companion to OmniAssert.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.0 167 6/26/2026
2.2.0 111 6/26/2026
2.1.0 114 6/25/2026
2.0.0 113 6/24/2026
1.3.0 139 6/7/2026
1.2.0 144 5/26/2026
1.1.2 110 5/18/2026
1.1.1 113 5/17/2026
1.1.0 117 5/17/2026
1.0.1 112 5/17/2026
1.0.0 106 5/16/2026
1.0.0-beta.1 56 5/7/2026
1.0.0-beta.0 57 5/6/2026
1.0.0-alpha.1 55 5/5/2026

v2.2.0
   - Added OmniAssert.Extensions companion package: web, financial, security, and regional fluent validators (email, URL, IBAN, JWT, Nigerian phone/BVN/NUBAN, and more).
   - Expanded automated test coverage across Core, Extensions, Analyzers, and Generator (80%+ line coverage on production assemblies).
   - Broadened SpanAssertions test coverage and consolidated legacy span wrapper tests.
   - Added analyzer code-fix tests for OA001–OA004 migration paths.
   - Updated documentation site and package examples for v2.2.0.