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
<PackageReference Include="AzureFunctions.TestFramework.RabbitMQ" Version="0.13.2" />
<PackageVersion Include="AzureFunctions.TestFramework.RabbitMQ" Version="0.13.2" />
<PackageReference Include="AzureFunctions.TestFramework.RabbitMQ" />
paket add AzureFunctions.TestFramework.RabbitMQ --version 0.13.2
#r "nuget: AzureFunctions.TestFramework.RabbitMQ, 0.13.2"
#:package AzureFunctions.TestFramework.RabbitMQ@0.13.2
#addin nuget:?package=AzureFunctions.TestFramework.RabbitMQ&version=0.13.2
#tool nuget:?package=AzureFunctions.TestFramework.RabbitMQ&version=0.13.2
AzureFunctions.TestFramework.RabbitMQ
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 | Versions 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. |
-
net10.0
- AzureFunctions.TestFramework.Core (>= 0.13.2)
- Microsoft.Azure.Functions.Worker.Extensions.RabbitMQ (>= 2.1.0)
-
net8.0
- AzureFunctions.TestFramework.Core (>= 0.13.2)
- Microsoft.Azure.Functions.Worker.Extensions.RabbitMQ (>= 2.1.0)
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 |