Architecture testing for .NET

ArchUnit.NET

Analyze C# projects and express boundaries as fluent, testable rules. The alpha includes cycles, dependency policies, naming, presets, baselines, and SARIF or HTML reporting for xUnit, NUnit, MSTest, and framework-neutral use.

Alpha previewC# & .NETApache-2.0

NuGet

dotnet add package ArchUnit --version 2.4.0-alpha.2
ArchitectureTests.cs
using ArchUnitNet;
using ArchUnitNet.Testing.XUnit;

[Fact]
public async Task DomainStaysIndependent()
{
    var rule = ArchUnit.ProjectFiles("./App.csproj")
        .InPath("src/Domain/**")
        .ShouldNot()
        .DependOnFiles()
        .InPath("src/Infrastructure/**");

    await rule.PassesAsync();
}

Capabilities

What ArchUnit.NET brings to the test suite.

The family shares a recognizable architecture vocabulary while each implementation stays honest about its language, toolchain, and maturity.

01

Cycles, boundaries, naming, and placement rules

02

xUnit, NUnit, and MSTest adapters

03

Architecture presets and gradual-adoption baselines

04

SARIF, JSON, text, and HTML reports

05

Structured violations for custom assertions

06

Async and framework-neutral execution

Current maturity

Alpha preview

An evaluation-only alpha under active development. APIs and behavior can still change before a stable release.

Language.NET
Release2.4.0-alpha.2
RuntimeC# & .NET
LicenseApache-2.0

Where it fits

Put boundaries next to the code they protect.

Common starting points for ArchUnit.NET include the following project shapes.

ASP.NET servicesModular monolithsClean architectureLegacy modernization

Make the first boundary executable.

Add one meaningful rule, run it with the existing tests, and grow the architecture suite as the system reveals where it needs protection.

Start with ArchUnit.NET ↗