ProtoTest.Messaging
1.0.1
dotnet add package ProtoTest.Messaging --version 1.0.1
NuGet\Install-Package ProtoTest.Messaging -Version 1.0.1
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="ProtoTest.Messaging" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ProtoTest.Messaging" Version="1.0.1" />
<PackageReference Include="ProtoTest.Messaging" />
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 ProtoTest.Messaging --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ProtoTest.Messaging, 1.0.1"
#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 ProtoTest.Messaging@1.0.1
#: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=ProtoTest.Messaging&version=1.0.1
#tool nuget:?package=ProtoTest.Messaging&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ProtoTest.Messaging
Publish messages and await the one that matters, with a predicate and a timeout, over a broker capability.
dotnet add package ProtoTest.Messaging
Quick start
builder.AddMessaging();
// Publish a command the application consumes.
await Proto.Context.Messaging().PublishAsync("invoices-create", """{"id":42}""");
// Await the event the application emits; failing to arrive is a real failure.
var message = await Proto.Context.Messaging().AwaitAsync(
"invoice.paid",
candidate => candidate.Payload!.Contains("\"id\":42"));
message.ShouldMatchShape(Proto.Context, new { id = 42, status = "Paid" });
What it adds
- Client —
Proto.Context.Messaging()withPublishAsync(destination, payload?, headers?, contentType?)andAwaitAsync(destination, predicate, timeout?); without a timeout the configured default applies. - Brokers —
AddMessaging(messaging => messaging.UseBroker(...))attaches an adapter; with none, an in-memory double serves the run and registers noBrokercapability, so[RequiresCapability(ProtoCapabilityKinds.Broker)]skips where no real broker exists. - Assertion —
message.ShouldMatchShape(Proto.Context, shape)recordsassert.json.shapeand amessaging.contract.shapeobservation, naming the destination when the payload is empty or not JSON. - Capture —
CaptureAttachments()records redacted published and matched payloads asmessage-publish-…/message-receive-…attachments; a capture failure is amessaging.attachment.failedevent and never fails the operation. - Tracing —
messaging.publish/messaging.awaitoperations andmessaging.publish/messaging.receiveobservations; the broker is a run-scoped resource.
Configuration
| Key | Type | Default |
|---|---|---|
ProtoTest:Messaging:DefaultTimeout |
TimeSpan |
00:00:10 |
ProtoTest:Messaging:Destinations |
IList<string> |
empty |
ProtoTest:Messaging:Attachments:CapturePublishedPayloads |
bool |
true |
ProtoTest:Messaging:Attachments:CaptureReceivedPayloads |
bool |
true |
ProtoTest:Messaging:Attachments:RedactSensitiveData |
bool |
true |
ProtoTest:Messaging:Attachments:MaxDiagnosticBodyLength |
int |
65536 |
ProtoTest:Messaging:Attachments:SensitiveJsonProperties |
List<string> |
password, token, access_token, refresh_token, secret, apiKey, api_key |
The in-memory double only sees messages published after its consumer starts, payloads are UTF-8 strings only, and the package ships no collector, so observations reach a report only through one.
Learn more
| 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 is compatible. 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.
-
net10.0
- ProtoTest.Core (>= 1.0.1)
- ProtoTest.Json (>= 1.0.1)
-
net8.0
- ProtoTest.Core (>= 1.0.1)
- ProtoTest.Json (>= 1.0.1)
-
net9.0
- ProtoTest.Core (>= 1.0.1)
- ProtoTest.Json (>= 1.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ProtoTest.Messaging:
| Package | Downloads |
|---|---|
|
ProtoTest.Messaging.RabbitMq
RabbitMQ adapter for the ProtoTest messaging capability: publish to exchanges and tap events with a per-test queue. |
GitHub repositories
This package is not used by any popular GitHub repositories.