AnyUnit 1.2.2

dotnet add package AnyUnit --version 1.2.2
                    
NuGet\Install-Package AnyUnit -Version 1.2.2
                    
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="AnyUnit" Version="1.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AnyUnit" Version="1.2.2" />
                    
Directory.Packages.props
<PackageReference Include="AnyUnit" />
                    
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 AnyUnit --version 1.2.2
                    
#r "nuget: AnyUnit, 1.2.2"
                    
#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 AnyUnit@1.2.2
                    
#: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=AnyUnit&version=1.2.2
                    
Install as a Cake Addin
#tool nuget:?package=AnyUnit&version=1.2.2
                    
Install as a Cake Tool

AnyUnit

Core library for AnyUnit: attribute base classes, the assertion helper, and the actual test discovery/ execution engine every style package (AnyUnit.Style.Nunit, AnyUnit.Style.Xunit, AnyUnit.Style.FSharp, AnyUnit.Style.FsUnit) and runner (AnyUnit.Runner, AnyUnit.Runner.BrowserWasm, AnyUnit.Runner.Bootstrap, AnyUnit.TestingPlatform) builds on.

You almost never reference this package directly - install a style package instead (it references this one transitively) and write tests in whichever framework's syntax that style ports. This package is what makes that syntax runnable on any platform netstandard2.0 reaches, including browser-wasm.

What lives here

  • TestFixtureAttributeBase / TestAttributeBase / TestFixtureDiscoveryAttributeBase - the base classes a style's own attributes ([TestFixture], [Test], ...) derive from, and the hooks (ParameterSets, TestInvoke, FixtureInit, ...) that let a style plug its own row-data/generator attributes and invocation behavior into one shared discovery/execution pipeline.
  • AssertionHelper / IAssert / AssertionException - the base a style's own assertion class derives from, and the exception types (AssertionException, IgnoreException) that drive a test's pass/fail/ignore outcome.
  • Runner / Fixture / Test / ParameterSet / Result - the engine: Runner.Create(platform, assemblies) discovers fixtures and builds a Test per parameter-set combination; RunAll executes them and reports a Result (Success/Fail/Error/Ignore/NoError) for each.

Asynchronous tests

A test method may return Task, Task<T>, ValueTask, ValueTask<T> or an F# Async<'T>. The engine waits for it before deciding the test's outcome, so a failed assertion inside an async body is reported Fail (and Assert.Ignore reported Ignore) just as it would be in a synchronous one, and [Timeout] still applies - it preempts a hung await the same way it preempts a hung loop. An async Task<bool> test gets the same "returned false means fail" handling as a plain bool one.

The one platform limit is single-threaded browser-wasm: a test whose awaits all complete synchronously (the overwhelmingly common case) runs there normally, but one that genuinely suspends can never resume, since its continuation needs the thread to yield back to the browser's event loop. Declare that with [RequiresCapability(TestCapabilities.AsyncYield)] and the engine reports the test Ignored there, naming the missing facility, while it runs normally everywhere else. An undeclared one gets a clear Error rather than hanging the page.

[RequiresCapability] is read by the engine, not by any one runner, so it works in every style and every host at once - TestCapabilities.Timeouts is the other current value, for tests that exist to prove [Timeout] actually fires.

See AnyUnit.Runner.Bootstrap for the smallest way to actually call Runner.Create/RunAll from your own entry point, or AnyUnit.TestingPlatform for a generated dotnet test-compatible one.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on AnyUnit:

Package Downloads
AnyUnit.Constraints

NUnit-style Has/Is fluent constraint syntax for AnyUnit.

AnyUnit.Style.Xunit

Roughly xUnit-compatible attributes and assertions for AnyUnit.

AnyUnit.TestingPlatform

Microsoft.Testing.Platform (MTP) adapter for AnyUnit - property-based opt-in via EnableAnyUnitRunner.

AnyUnit.Style.FsUnit

FsUnit-style F# assertions for AnyUnit.

AnyUnit.Style.Nunit

Roughly NUnit-compatible attributes and assertions for AnyUnit.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.2 1,246 9/16/2026
1.2.1 202 9/16/2026
1.2.0 266 9/16/2026
1.2.0-alpha.0.6 76 9/14/2026
1.1.0 287 9/14/2026
1.0.0 275 9/12/2026