![]() |
VOOZH | about |
dotnet add package AzureFunctions.TestFramework.RabbitMQ --version 0.14.0
NuGet\Install-Package AzureFunctions.TestFramework.RabbitMQ -Version 0.14.0
<PackageReference Include="AzureFunctions.TestFramework.RabbitMQ" Version="0.14.0" />
<PackageVersion Include="AzureFunctions.TestFramework.RabbitMQ" Version="0.14.0" />Directory.Packages.props
<PackageReference Include="AzureFunctions.TestFramework.RabbitMQ" />Project file
paket add AzureFunctions.TestFramework.RabbitMQ --version 0.14.0
#r "nuget: AzureFunctions.TestFramework.RabbitMQ, 0.14.0"
#:package AzureFunctions.TestFramework.RabbitMQ@0.14.0
#addin nuget:?package=AzureFunctions.TestFramework.RabbitMQ&version=0.14.0Install as a Cake Addin
#tool nuget:?package=AzureFunctions.TestFramework.RabbitMQ&version=0.14.0Install as a Cake Tool
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.
string parameterusing 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);
}
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);
byte[] or BinaryData parameterUse the byte[] overload and pass the raw body bytes. The same optional RabbitMqTriggerMessageProperties overload exists after the byte[] argument.
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.
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 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.
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.