AzureFunctions.TestFramework.RabbitMQ 0.13.2

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

AzureFunctions.TestFramework.RabbitMQ

NuGet

RabbitMQTrigger invocation support for the Azure Functions Test Framework. Provides InvokeRabbitMQAsync(...) — extensions on IFunctionsTestHost that let you trigger RabbitMQ-triggered functions directly from integration tests without a real RabbitMQ broker.

Usage

Functions with string parameter

using AzureFunctions.TestFramework.Core;
using AzureFunctions.TestFramework.RabbitMQ;

[Fact]
public async Task ProcessRabbitMq_WithStringBody_Succeeds()
{
    var result = await _testHost.InvokeRabbitMQAsync("ProcessRabbitMqMessage", "Hello from test!");
    Assert.True(result.Success);
}

Optional delivery / application properties

Pass a RabbitMqTriggerMessageProperties instance (for example RoutingKey, MessageId, Exchange, Headers) so values appear in InvocationRequest.TriggerMetadata and are available from FunctionContext.BindingContext.BindingData in the function:

var props = new RabbitMqTriggerMessageProperties
{
    RoutingKey = "my.route",
    MessageId = "correlation-1"
};
var result = await _testHost.InvokeRabbitMQAsync(
    "ProcessRabbitMqWithMetadata",
    "payload",
    props,
    TestContext.Current.CancellationToken);
Assert.True(result.Success);

Functions with byte[] or BinaryData parameter

Use the byte[] overload and pass the raw body bytes. The same optional RabbitMqTriggerMessageProperties overload exists after the byte[] argument.

Functions with a JSON POCO parameter

Use the generic overload when the trigger parameter is a type deserialized from JSON (dotnet-isolated):

var result = await _testHost.InvokeRabbitMQAsync(
    "ProcessRabbitMqOrder",
    new RabbitMqOrderPayload { OrderId = "order-42" });
Assert.True(result.Success);

Optional metadata can be passed between payload and JsonSerializerOptions.

API

Task<FunctionInvocationResult> InvokeRabbitMQAsync(
    this IFunctionsTestHost host,
    string functionName,
    string message,
    CancellationToken cancellationToken = default)

Task<FunctionInvocationResult> InvokeRabbitMQAsync(
    this IFunctionsTestHost host,
    string functionName,
    string message,
    RabbitMqTriggerMessageProperties? messageProperties,
    CancellationToken cancellationToken = default)

Task<FunctionInvocationResult> InvokeRabbitMQAsync(
    this IFunctionsTestHost host,
    string functionName,
    byte[] body,
    CancellationToken cancellationToken = default)

Task<FunctionInvocationResult> InvokeRabbitMQAsync(
    this IFunctionsTestHost host,
    string functionName,
    byte[] body,
    RabbitMqTriggerMessageProperties? messageProperties,
    CancellationToken cancellationToken = default)

Task<FunctionInvocationResult> InvokeRabbitMQAsync<T>(
    this IFunctionsTestHost host,
    string functionName,
    T payload,
    JsonSerializerOptions? jsonSerializerOptions = null,
    CancellationToken cancellationToken = default)

Task<FunctionInvocationResult> InvokeRabbitMQAsync<T>(
    this IFunctionsTestHost host,
    string functionName,
    T payload,
    RabbitMqTriggerMessageProperties? messageProperties,
    JsonSerializerOptions? jsonSerializerOptions = null,
    CancellationToken cancellationToken = default)
  • functionName — the name of the RabbitMQ function (case-insensitive).
  • message / body — payload delivered to the trigger binding (UTF-8 text or raw bytes).
  • payload — object serialized to JSON for POCO trigger parameters.
  • messageProperties — optional metadata mapped to gRPC trigger metadata (RabbitMQ / AMQP-style keys).

Output binding capture

Output bindings (for example [RabbitMQOutput] on a return type property) are captured in FunctionInvocationResult.OutputData — use ReadOutputAs<T>(bindingName) (typically the property name on your return POCO). The raw ReturnValue is also populated for diagnostics; prefer ReadOutputAs for asserting named output bindings.

References

License

MIT

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 is compatible.  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
0.13.2 90 4/30/2026