DontPanicLabs.Ifx.Proxy.Autofac.Extensions 1.0.0

Prefix Reserved
dotnet add package DontPanicLabs.Ifx.Proxy.Autofac.Extensions --version 1.0.0
                    
NuGet\Install-Package DontPanicLabs.Ifx.Proxy.Autofac.Extensions -Version 1.0.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="DontPanicLabs.Ifx.Proxy.Autofac.Extensions" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DontPanicLabs.Ifx.Proxy.Autofac.Extensions" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DontPanicLabs.Ifx.Proxy.Autofac.Extensions" />
                    
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 DontPanicLabs.Ifx.Proxy.Autofac.Extensions --version 1.0.0
                    
#r "nuget: DontPanicLabs.Ifx.Proxy.Autofac.Extensions, 1.0.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 DontPanicLabs.Ifx.Proxy.Autofac.Extensions@1.0.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=DontPanicLabs.Ifx.Proxy.Autofac.Extensions&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DontPanicLabs.Ifx.Proxy.Autofac.Extensions&version=1.0.0
                    
Install as a Cake Tool

DontPanicLabs.Ifx.Proxy.Extensions

Extension methods and utilities for the Don't Panic Labs Infrastructure Framework (Ifx) proxy system. This package provides helpful extensions for testing, interceptor development, and proxy management.

Features

Interceptor Extensions

  • IInvocationExtensions: Helper methods for working with Castle DynamicProxy invocations
    • GetFirstArgument<T>() - Safely extract and cast the first argument
    • GetTaskResultType() - Get the result type from Task<T> return types
    • IsTaskReturning() - Check if method returns a Task<T>

Testing Utilities

  • MockProxyGenerator: A test-friendly implementation of IProxyGenerator that returns mocks instead of real proxies
  • MockExtensions: Extension methods for easily mocking dependencies in unit tests
  • MockProxyContext: A simple test context for use with mock proxy generators

Usage

Unit Testing with Mock Dependencies

// In your unit test
var serviceUnderTest = new MyProxyEnabledService();
var mockDependency = serviceUnderTest.MockDependency<IMyDependency>();

// Configure the mock
mockDependency.Setup(x => x.DoSomething()).Returns("test result");

// Test your service - it will receive the mock when it calls ProxyForService<IMyDependency>()
var result = await serviceUnderTest.ProcessData();

Interceptor Development

public class MyInterceptor : IInterceptor
{
    public void Intercept(IInvocation invocation)
    {
        if (invocation.IsTaskReturning())
        {
            var resultType = invocation.GetTaskResultType();
            // Handle async methods
        }
        
        var criteria = invocation.GetFirstArgument<MyCriteria>();
        // Process the criteria
        
        invocation.Proceed();
    }
}

Installation

dotnet add package DontPanicLabs.Ifx.Proxy.Extensions

Requirements

  • .NET 8.0 or later
  • DontPanicLabs.Ifx.Proxy.Contracts
  • DontPanicLabs.Ifx.Services.Contracts

Feedback

Submit issues at: https://github.com/dontpaniclabs/DontPanicLabs.Ifx/issues

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.0.0 146 8/11/2025