Zphil.LoadBearing.Xunit
0.1.0
dotnet add package Zphil.LoadBearing.Xunit --version 0.1.0
NuGet\Install-Package Zphil.LoadBearing.Xunit -Version 0.1.0
<PackageReference Include="Zphil.LoadBearing.Xunit" Version="0.1.0" />
<PackageVersion Include="Zphil.LoadBearing.Xunit" Version="0.1.0" />
<PackageReference Include="Zphil.LoadBearing.Xunit" />
paket add Zphil.LoadBearing.Xunit --version 0.1.0
#r "nuget: Zphil.LoadBearing.Xunit, 0.1.0"
#:package Zphil.LoadBearing.Xunit@0.1.0
#addin nuget:?package=Zphil.LoadBearing.Xunit&version=0.1.0
#tool nuget:?package=Zphil.LoadBearing.Xunit&version=0.1.0
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 => FindUp("MyApp.sln");
private static string FindUp(string name)
{
var directory = new DirectoryInfo(AppContext.BaseDirectory);
while (directory is not null && !File.Exists(Path.Combine(directory.FullName, name)))
directory = directory.Parent;
return Path.Combine(directory!.FullName, name);
}
}
SolutionPath is the only required override. Resolve the path however suits your repo;
relative values resolve against the test process's working directory, so the example walks up
from the test output directory instead. 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 Freeze 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). 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.
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.1.0)
- Zphil.LoadBearing.Roslyn (>= 0.1.0)
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 |
|---|---|---|
| 0.1.0 | 84 | 7/14/2026 |