Digitals.Testing 1.0.0

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

Digitals.Testing

Digitals.Testing is the whole test stack for a .NET test project in one reference: xunit.v3 on Microsoft.Testing.Platform, NSubstitute, FakeTimeProvider, Microsoft's coverage engine and the TRX reporter. It adds the Digitals test policy, our own DT1#### rules and a coverage gate that fails the run below the floor. It is the test-project companion to Digitals.Analyzers.

Reference it from each test project, and remove the test packages it replaces (xunit.v3, xunit, xunit.runner.visualstudio, Microsoft.NET.Test.Sdk, NSubstitute, Moq, coverlet.collector, coverlet.msbuild, FluentAssertions, Microsoft.Extensions.TimeProvider.Testing, Microsoft.Testing.Extensions.TrxReport). The reference has no Version because it assumes central package management; without it, add Version with the latest from this page:

<ItemGroup>
  <PackageReference Include="Digitals.Testing" />
</ItemGroup>

Select the Microsoft.Testing.Platform runner in global.json at the repo root. Without it, dotnet build fails with DIGT001 and .NET 10's dotnet test refuses to run, since the VSTest route would collect no coverage and never run the gate:

{
  "test": { "runner": "Microsoft.Testing.Platform" }
}
What Does
Project defaults OutputType=Exe, IsTestProject, IsPackable=false and global using Xunit.
Test policy A global AnalyzerConfig at global_level 300, which relaxes the production rules that fight the way tests are written and raises a skipped test (xUnit1004) to a warning.
DT1#### rules Test names made of PascalCase segments, a Category trait on every test, no wall-clock waits, and an assertion every test reaches.
DIGT002 Fails the build on a direct reference to the VSTest stack, coverlet, Moq, FluentAssertions, xUnit v2, NUnit, MSTest, or the xUnit v2 builds of ArchUnitNET, FsCheck, Verify and Playwright.
Coverage Collected on every dotnet test, with no flags. Test assemblies, generated code, migrations and [ExcludeFromCodeCoverage] are left out.
Coverage gate Fails the run below 100% line or branch coverage, above a CRAP score of 30 or above a cyclomatic complexity of 20 in any method.
TRX report Written to TestResults/ for a CI step to publish. <DigitalsTrxReport>false</DigitalsTrxReport> turns it off.

Below a floor, dotnet test fails with the numbers:

Line coverage 82.4% is below the 100.0% floor (416 of 505 covered). Add tests; do not lower the floor.

Each limit is a property (DigitalsMinLineCoverage, DigitalsMinBranchCoverage, DigitalsMaxCrapScore, DigitalsMaxCyclomaticComplexity) and a ratchet: an existing repo sets it once to where it is, beside a comment naming what moves it back, and tightens it from there. DigitalsSkipCoverageGate turns the gate off and keeps the report.

The Testing rules page explains every rule, check and limit, with a failing and a passing example and the message it prints. Moving an existing repo's tests onto the package: the adoption guide.

No PrivateAssets on the reference: the package carries runtime assemblies, and a shared test-utilities library that packs itself needs them to flow on. The package targets net10.0 and later. The bundled packages keep their own licences and reach you as ordinary NuGet dependencies. Release notes are on GitHub Releases.

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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.