Zphil.LoadBearing.Xunit
0.3.1
See the version list below for details.
dotnet add package Zphil.LoadBearing.Xunit --version 0.3.1
NuGet\Install-Package Zphil.LoadBearing.Xunit -Version 0.3.1
<PackageReference Include="Zphil.LoadBearing.Xunit" Version="0.3.1" />
<PackageVersion Include="Zphil.LoadBearing.Xunit" Version="0.3.1" />
<PackageReference Include="Zphil.LoadBearing.Xunit" />
paket add Zphil.LoadBearing.Xunit --version 0.3.1
#r "nuget: Zphil.LoadBearing.Xunit, 0.3.1"
#:package Zphil.LoadBearing.Xunit@0.3.1
#addin nuget:?package=Zphil.LoadBearing.Xunit&version=0.3.1
#tool nuget:?package=Zphil.LoadBearing.Xunit&version=0.3.1
Zphil.LoadBearing.Xunit
Zphil.LoadBearing.Xunit is the LoadBearing xUnit
adapter: every rule in an architecture spec runs as an individually named xUnit test. The rule
ID is the test's display name, and a failing rule's message is the exact human block the
loadbearing CLI prints.
Usage
Derive a class from ArchRuleTests<TSpec> in your test project and point it at the solution
to check:
using Zphil.LoadBearing.Xunit;
public sealed class ArchitectureTests : ArchRuleTests<MyApp.ArchSpec.ArchSpec>
{
protected override string SolutionPath => FindSolutionUp("MyApp.sln");
}
SolutionPath is the only required override. FindSolutionUp climbs from the test output
directory to the first ancestor holding the named file and returns its absolute path, throwing
FileNotFoundException naming the start directory on a miss. Resolve the path however suits
your repo; relative values resolve against the test process's working directory, not the output
directory FindSolutionUp starts from. The test explorer lists one case per rule ID; the
workspace load, extraction, and check run once per spec type, and every rule case reads its
verdict from that shared run. A Quarantine tripwire rule reports as skipped (a test run has no
diff context); everything else passes or fails like any other test.
When the spec project is a member of the checked solution it is excluded from the checked
universe automatically (mirroring the CLI), along with any project only it pulls in: a library
the spec references that the solution file does not declare, such as a shared rule pack.
Projects the solution declares stay in the universe even when the spec references them, so a
spec may reference the very code it governs. If your spec lives outside the target solution,
override ExcludeProjectName to return null.
Requirements
- xunit.v3 3.2.2 or later. The adapter is built against the xunit.v3 authoring libraries;
a consumer on an older metapackage hits a package-downgrade error. Your test project keeps
its own
xunit.v3metapackage and runner references; the adapter brings only the authoring pair. - A .NET SDK on the test host. The checker loads the target solution through MSBuildWorkspace (via MSBuildLocator), so plain runtime-only environments cannot run these tests.
- The target solution must be restored and built before the tests run. The checker never builds; stale builds give stale verdicts.
Writing the spec
The spec itself is authored against the
Zphil.LoadBearing contract package; see
its README for the fluent surface. The
Zphil.LoadBearing.Cli global tool
runs the same rules at the command line, in CI, and as an MCP server for coding agents; the
adapter and the CLI produce identical failure text by construction. All four LoadBearing
packages ship one version in lockstep; reference the adapter and the contract at the same one.
License
| Product | Versions 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. |
-
net10.0
- xunit.v3.assert (>= 3.2.2)
- xunit.v3.extensibility.core (>= 3.2.2)
- Zphil.LoadBearing (>= 0.3.1)
- Zphil.LoadBearing.Roslyn (>= 0.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.