FsArchUnit 1.0.8.29158
See the version list below for details.
dotnet add package FsArchUnit --version 1.0.8.29158
NuGet\Install-Package FsArchUnit -Version 1.0.8.29158
<PackageReference Include="FsArchUnit" Version="1.0.8.29158" />
paket add FsArchUnit --version 1.0.8.29158
#r "nuget: FsArchUnit, 1.0.8.29158"
// Install FsArchUnit as a Cake Addin #addin nuget:?package=FsArchUnit&version=1.0.8.29158 // Install FsArchUnit as a Cake Tool #tool nuget:?package=FsArchUnit&version=1.0.8.29158
FsArchUnit
A fsharp API for that can enforce architectural rules in unit tests.
A rewrite from BenMorris/NetArchTest which is inspired by the ArchUnit library for Java.
Rationale
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.
Examples
// 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 is compatible. net5.0-windows was computed. net6.0 was computed. 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-browser 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. |
-
.NETStandard 2.0
- FSharp.Core (>= 6.0.0)
- Mono.Cecil (>= 0.11.4)
-
net5.0
- FSharp.Core (>= 6.0.0)
- Mono.Cecil (>= 0.11.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.8.52452 | 326 | 12/10/2022 |
1.0.8.29158 | 354 | 10/23/2021 |