AnyUnit.Style.Nunit 1.3.0

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

AnyUnit.Style.Nunit

Roughly NUnit-compatible attributes and assertions for AnyUnit - close enough to real NUnit's own syntax that a test's logic often doesn't need to change, run anywhere AnyUnit's core reaches (including browser-wasm) - not a full reimplementation of NUnit's API (see "Not covered" below). Ported from real NUnit's own source (see Contributors.md for attribution).

Moving an existing NUnit test project onto this is usually a PackageReference swap, not a source rewrite - using NUnit.Framework; becomes using AnyUnit; using AnyUnit.Style.Nunit; using AnyUnit.Constraints; (the last covers TestDelegate; the first covers AssertionException, IgnoreException and [RequiresCapability]), and a fixture class needs to derive AssertionHelper for its Assert/Log to resolve.

Before 1.3.0 that first using was using AnyUnit.Run; and AnyUnit.AssertionException had to be written out in full, because the AnyUnit namespace also held the core's own [Test]/[TestFixture]/ AssertionHelper and importing it made all three ambiguous. Those moved to AnyUnit.Style.Core in 1.3.0 (#66); on 1.2.x, using AssertionException = AnyUnit.AssertionException; gets the short name back without the upgrade. Once it does, Assert.That(...) and every other call inside an ordinary test method carries over completely unchanged - it's just resolving to that instance now, the same identifier either way. The one real, load-bearing difference (AnyUnit's Assert is an instance property, not the fully-static class real NUnit's is - see AnyUnit's own README for why) only actually shows up in a plain helper class that isn't itself a fixture and wants to assert - a real but narrow case, not something ordinary test methods ever run into.

Covers

  • [TestFixture] (including parameterized: [TestFixture(args)]), [SetUpFixture]
  • [Test], [TestCase] (including per-case Ignore = "reason"), [Theory] (including automatic enum-value expansion for a parameter with no explicit data source)
  • [SetUp] / [TearDown] / [OneTimeSetUp] / [OneTimeTearDown]
  • [Values] / [ValueSource] / [Range] / [Random]
  • [Ignore], [Category], [Property], [Author], [Description], [Platform], [Timeout]
  • ITestAction (method/fixture-level before/after hooks)
  • Assert.That and the Is/Has/Does/Throws constraints (via AnyUnit.Constraints), and the classic model over the same constraints: AreEqual, AreNotEqual, AreSame, AreNotSame, IsTrue, IsFalse, IsNull, IsNotNull, NotNull, Greater, GreaterOrEqual, Less, LessOrEqual, Zero, NotZero, IsInstanceOf<T>, IsNotInstanceOf<T>, IsEmpty, IsNotEmpty, Contains, Throws<T>, Catch<T>, DoesNotThrow, Pass. AreEqual is NUnit's equality, so AreEqual(1, 1L) passes; Throws<T> returns the caught exception to assert on

Not covered

Real NUnit's TestContext (no equivalent - use AppContext.BaseDirectory for a working-directory-relative path instead) and its fully-static Assert/Assume. The static-Assert gap is deliberate, not an oversight: a shared/global assert can't reliably tell a test that made real assertions and passed apart from one that made none at all and trivially "passed" by doing nothing, whereas an instance scoped to exactly one test's own run tracks that correctly (AssertCount, behind the Success/NoError result distinction). A non-fixture helper class that wants to assert throws AnyUnit.AssertionException/IgnoreException directly instead of calling a static Assert.Fail/Assert.Ignore - the one place this actually comes up in practice (an ordinary test method already has a real Assert to call, via its fixture).

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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 250 9/22/2026
1.2.2 81 9/16/2026
1.2.1 81 9/16/2026
1.2.0 82 9/16/2026
1.2.0-alpha.0.6 52 9/14/2026
1.1.0 123 9/14/2026
1.0.0 118 9/12/2026