JAAvila.FluentOperations.Architecture 1.5.0

dotnet add package JAAvila.FluentOperations.Architecture --version 1.5.0
                    
NuGet\Install-Package JAAvila.FluentOperations.Architecture -Version 1.5.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="JAAvila.FluentOperations.Architecture" Version="1.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JAAvila.FluentOperations.Architecture" Version="1.5.0" />
                    
Directory.Packages.props
<PackageReference Include="JAAvila.FluentOperations.Architecture" />
                    
Project file
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 JAAvila.FluentOperations.Architecture --version 1.5.0
                    
#r "nuget: JAAvila.FluentOperations.Architecture, 1.5.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 JAAvila.FluentOperations.Architecture@1.5.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=JAAvila.FluentOperations.Architecture&version=1.5.0
                    
Install as a Cake Addin
#tool nuget:?package=JAAvila.FluentOperations.Architecture&version=1.5.0
                    
Install as a Cake Tool

JAAvila.FluentOperations.Architecture

Mono.Cecil-powered IL-level dependency scanning for JAAvila.FluentOperations architecture tests.

What it does

This package enhances the HaveDependencyOn, NotHaveDependencyOn, and OnlyHaveDependenciesOn operations with deep method body analysis via Mono.Cecil IL inspection.

Without this package, dependency operations use reflection-only scanning (type signatures: fields, properties, constructors, method signatures, base types, interfaces, attributes). This covers ~60% of real-world dependencies.

With this package activated, the scanner also detects dependencies inside method bodies:

Dependency type Reflection Cecil
Field types, property types, method signatures YES YES
Constructor parameters, return types, base types, interfaces YES YES
Custom attributes, generic type arguments YES YES
Local variables in method bodies NO YES
new SomeType() in method bodies NO YES
typeof(SomeType) in method bodies NO YES
Cast expressions ((T)obj) NO YES
is/as expressions NO YES
Static and instance method calls NO YES
Static and instance field access NO YES
Exception catch types NO YES
Lambda/closure target types NO YES
Async state machine dependencies NO YES
Iterator state machine dependencies NO YES

Requirements

  • JAAvila.FluentOperations (Core)
  • .NET 8.0 or later
  • Mono.Cecil 0.11.6 (included as a dependency)

Installation

dotnet add package JAAvila.FluentOperations.Architecture

Usage

Call ArchitectureScannerConfig.UseCecilDependencyScanning() once in your test setup:

using JAAvila.FluentOperations.Architecture;

[TestFixture]
public class ArchitectureTests
{
    [OneTimeSetUp]
    public void SetUp()
    {
        ArchitectureScannerConfig.UseCecilDependencyScanning();
    }

    [OneTimeTearDown]
    public void TearDown()
    {
        ArchitectureScannerConfig.Reset();
    }

    [Test]
    public void DomainLayer_ShouldNotDependOnInfrastructure()
    {
        // Detects dependencies in method bodies too
        typeof(DomainService).Test()
            .NotHaveDependencyOn("MyApp.Infrastructure");
    }

    [Test]
    public void DomainLayer_OnlyDependsOnAllowedNamespaces()
    {
        // Cecil scanner catches new SqlConnection() inside method bodies
        typeof(DomainEntity).Test()
            .OnlyHaveDependenciesOn("MyApp.Domain", "MyApp.SharedKernel");
    }
}

No existing test code needs to change. The enhanced scanner is transparent — the same HaveDependencyOn, NotHaveDependencyOn, and OnlyHaveDependenciesOn calls automatically use IL-level detection when Cecil is active.

Graceful degradation

If an assembly cannot be loaded (dynamic assemblies, single-file apps, NativeAOT), the scanner falls back to reflection-only results. Cecil scanning never makes tests worse — it only makes them more accurate.

Teardown

Always call ArchitectureScannerConfig.Reset() in test teardown to release cached assembly data and restore the default reflection scanner.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.5.0 219 3/29/2026