Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. .NET
  3. ArchUnitNET

ArchUnitNET

Apache-2.0C#0.13.3

A C# library for specifying and asserting architecture rules in automated tests, based on ArchUnit for Java.

GitHubGitHub
1.3k stars75 forks0 contributors

What is ArchUnitNET?

ArchUnitNET is a C# architecture test library that allows developers to specify and assert architectural rules in their codebase through automated tests. It helps enforce coding standards, layer dependencies, and design patterns by analyzing compiled assemblies and validating them against defined constraints. This prevents architectural drift and ensures code consistency across projects.

Target Audience

C# developers and software architects working on medium to large codebases who need to maintain architectural integrity and enforce coding standards through automated testing.

Value Proposition

Developers choose ArchUnitNET for its fluent API, seamless integration with popular .NET test frameworks, and its proven approach ported from the Java ArchUnit ecosystem. It provides a specialized, lightweight way to codify architecture rules that traditional unit tests cannot easily cover.

Overview

A C# architecture test library to specify and assert architecture rules in C# for automated testing.

Use Cases

Best For

  • Enforcing layer dependencies in a layered or hexagonal architecture
  • Preventing circular dependencies between namespaces or projects
  • Validating naming conventions for classes and interfaces
  • Ensuring that certain classes do not call forbidden methods
  • Maintaining separation of concerns in legacy code refactoring
  • Automating architecture compliance in CI/CD pipelines

Not Ideal For

  • Projects that exclusively run unit tests in Release configuration, due to accuracy reliance on debug artifacts
  • Teams working with highly dynamic codebases using extensive reflection or runtime assembly loading
  • Small-scale applications where the overhead of architectural testing doesn't justify the maintenance effort

Pros & Cons

Pros

Fluent API for Rules

Provides an intuitive, chainable syntax for defining architecture rules, as shown with methods like That().ResideInNamespace() in the README, making complex conditions easy to compose.

Test Framework Integration

Offers dedicated NuGet packages for xUnit, NUnit, and MSTestV2, allowing architecture tests to run seamlessly alongside standard unit tests without additional setup.

Comprehensive Bytecode Analysis

Analyzes compiled C# assemblies to build a detailed code structure, enabling validation of dependencies between classes, members, and interfaces for thorough architecture checks.

Custom Rule Composition

Supports combining multiple rules and adding descriptive failure reasons, as demonstrated in the example, which aids in debugging and identifying specific architectural violations.

Cons

Debug Configuration Dependency

The README explicitly recommends running tests in Debug configuration for accuracy, which can conflict with testing strategies that prioritize Release builds or optimized pipelines.

Performance Overhead

Loading and analyzing multiple assemblies during test execution can slow down tests, especially for large codebases, impacting CI/CD pipeline efficiency and developer feedback loops.

Limited to Static Analysis

Since it inspects bytecode, it cannot capture runtime dependencies or dynamic code behaviors, such as reflection-based calls, potentially missing issues that only occur during execution.

Frequently Asked Questions

Quick Stats

Stars1,274
Forks75
Contributors0
Open Issues23
Last commit1 day ago
CreatedSince 2019

Tags

#unit-testing#mstest#csharp#fluent-api#code-quality#nunit#architecture-testing#xunit#dependency-checking#static-analysis

Built With

C
C++

Included in

.NET21.2kStatic Analysis & Code Quality14.5k
Auto-fetched 1 day ago

Related Projects

PHP ParserPHP Parser

A PHP parser written in PHP

Stars17,432
Forks1,120
Last commit2 months ago
TypeScript ESLintTypeScript ESLint

:sparkles: Monorepo for all the tooling which enables ESLint to support TypeScript

Stars16,221
Forks2,908
Last commit1 day ago
pyrightpyright

Static Type Checker for Python

Stars15,394
Forks1,782
Last commit5 days ago
BogusBogus

:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.

Stars9,648
Forks540
Last commit4 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub