Personix.ArchitectureTests
1.1.0
dotnet add package Personix.ArchitectureTests --version 1.1.0
NuGet\Install-Package Personix.ArchitectureTests -Version 1.1.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="Personix.ArchitectureTests" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Personix.ArchitectureTests" Version="1.1.0" />
<PackageReference Include="Personix.ArchitectureTests" />
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 Personix.ArchitectureTests --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Personix.ArchitectureTests, 1.1.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 Personix.ArchitectureTests@1.1.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=Personix.ArchitectureTests&version=1.1.0
#tool nuget:?package=Personix.ArchitectureTests&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Personix.ArchitectureTests
Shared Clean Architecture enforcement helpers built on NetArchTest.Rules.
What's included
| Type | Purpose |
|---|---|
ICleanArchitectureAssemblies |
Interface mapping your assemblies to CA layers |
CleanArchitectureRules |
Static methods for each standard dependency rule |
ArchitectureTestResult |
Value-object result with a human-readable failure message |
CleanArchitectureTestBase |
xUnit base class – inherit and get all rules as auto-generated Facts |
Usage
Option A – Inherit the base class (recommended)
// Architecture.Tests project in your solution
internal sealed class MyLayerAssemblies : ICleanArchitectureAssemblies
{
public Assembly Domain => typeof(global::Domain.AssemblyMarker).Assembly;
public Assembly Application => typeof(global::Application.AssemblyMarker).Assembly;
public Assembly? Infrastructure => typeof(global::Infrastructure.AssemblyMarker).Assembly;
public Assembly? Persistence => typeof(global::Persistence.AssemblyMarker).Assembly;
public Assembly? Presentation => typeof(global::Presentation.AssemblyMarker).Assembly;
}
public class ArchTests : CleanArchitectureTestBase
{
protected override ICleanArchitectureAssemblies Assemblies { get; } = new MyLayerAssemblies();
// All 5 standard Facts are now executed automatically.
}
Option B – Call rules individually
var assemblies = new MyLayerAssemblies();
var result = CleanArchitectureRules.DomainMustNotDependOnOtherLayers(assemblies);
Assert.True(result.IsSuccessful, result.FailingMessage());
Standard rules enforced
- Domain must not depend on Application, Infrastructure, Persistence or Presentation
- Application must not depend on Infrastructure, Persistence or Presentation
- Infrastructure must not depend on Presentation
- Persistence must not depend on Infrastructure
- Persistence must not depend on Presentation
Rules for null assemblies are automatically skipped (e.g. when you have no Persistence layer).
| 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. net11.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- NetArchTest.Rules (>= 1.3.2)
- xunit (>= 2.9.3)
-
net11.0
- NetArchTest.Rules (>= 1.3.2)
- xunit (>= 2.9.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
1.1.0 — adds a net11.0 target alongside net10.0. No API change.