dotnet add package FsArchUnit --version 184.108.40.206452
NuGet\Install-Package FsArchUnit -Version 220.127.116.11452
<PackageReference Include="FsArchUnit" Version="18.104.22.168452" />
paket add FsArchUnit --version 22.214.171.124452
#r "nuget: FsArchUnit, 126.96.36.199452"
// Install FsArchUnit as a Cake Addin #addin nuget:?package=FsArchUnit&version=188.8.131.52452 // Install FsArchUnit as a Cake Tool #tool nuget:?package=FsArchUnit&version=184.108.40.206452
A fsharp API for that can enforce architectural rules in unit tests.
This project allows you create tests that enforce conventions for class design, naming and dependency in .Net code bases. These can be used with any unit test framework and incorporated into a build pipeline. It uses a fluid API that allows you to string together readable rules that can be used in test assertions.
There are plenty of static analysis tools that can evaluate application structure, but they are aimed more at enforcing generic best practice rather than application-specific conventions. The better tools in this space can be press-ganged into creating custom rules for a specific architecture, but the intention here is to incorporate rules into a test suite and create a self-testing architecture.
The project is inspired by ArchUnit, a java-based library that attempts to address the difficulties of preserving architectural design patterns in code bases over the long term. Many patterns can only be enforced by convention, which tends to rely on a rigorous and consistent process of code review. This discipline often breaks down as projects grow, use cases become more complex and developers come and go.
// Classes in the presentation should not directly reference repositories let violations = Types.InCurrentDomain() |> That (ResideInNamespace "SampleLibrary.Presentation") |> Should (Not (HaveDependencyOn "SampleLibrary.Data")) |> Check // Classes in the "data" namespace should implement IRepository let violations = Types.InCurrentDomain() |> That ((HaveDependencyOn "System.Data") |> And <| (ResideInNamespace "ArchTest")) |> Should (ResideInNamespace "SampleLibrary.Data") |> Check // All the service classes should be sealed let violations = Types.InCurrentDomain() |> That (ImplementInterface typedefof<IWidgetService>) |> Should (Be Sealed) |> Check
|Product||Versions Compatible and additional computed target framework versions.|
|.NET||net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed.|
|.NET Core||netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed.|
|.NET Standard||netstandard2.0 is compatible. netstandard2.1 was computed.|
|.NET Framework||net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed.|
|MonoAndroid||monoandroid was computed.|
|MonoMac||monomac was computed.|
|MonoTouch||monotouch was computed.|
|Tizen||tizen40 was computed. tizen60 was computed.|
|Xamarin.iOS||xamarinios was computed.|
|Xamarin.Mac||xamarinmac was computed.|
|Xamarin.TVOS||xamarintvos was computed.|
|Xamarin.WatchOS||xamarinwatchos was computed.|
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.