A C# architecture test library to specify and assert architecture rules in C# for automated testing.
A C# architecture test library to specify and assert architecture rules in C# for automated testing.
Visit our documentation at https://archunitnet.readthedocs.io/en/latest/.
ArchUnitNET is a free, simple library for checking the architecture of C# code. It is the C# fork of https://www.archunit.org/ for Java. ArchUnitNET can check dependencies between classes, members, interfaces, and more. This is done by analyzing C# bytecode and importing all classes into our C# code structure. The main focus of ArchUnitNET is to automatically test architecture and coding rules.
To use ArchUnitNET, install the ArchUnitNET package from NuGet:
PS> Install-Package TngTech.ArchUnitNET
If you want to use xUnit, NUnit or MSTestV2 for your unit tests, you should instead install the corresponding ArchUnit extension:
PS> Install-Package TngTech.ArchUnitNET.xUnit
PS> Install-Package TngTech.ArchUnitNET.xUnitV3
PS> Install-Package TngTech.ArchUnitNET.NUnit
PS> Install-Package TngTech.ArchUnitNET.MSTestV2
Then you will want to create a class to start testing. We used xUnit with the ArchUnit extension here, but it works similarly with NUnit or other Unit Test Frameworks.
…
Since ArchUnitNET is reading the architecture form the analyzed binaries, it is recommended to run ArchUnitNET-based tests in Debug configuration.
dotnet test -c Debug
For more details on known edge cases, see the documentation.
Check out test examples for the current release at ArchUnitNET Examples.
ArchUnitNET is published under the Apache License 2.0. For more information concerning the license, see Apache License 2.0.
Thanks to all the people who have contributed to the project.
No open issues yet, or sync has not completed.