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" />
                    
Directory.Packages.props
<PackageReference Include="ProtoTest.Messaging" />
                    
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 ProtoTest.Messaging --version 1.0.1
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=ProtoTest.Messaging&version=1.0.1
                    
Install as a Cake Tool

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() with PublishAsync(destination, payload?, headers?, contentType?) and AwaitAsync(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 no Broker capability, so [RequiresCapability(ProtoCapabilityKinds.Broker)] skips where no real broker exists.
  • Assertion — message.ShouldMatchShape(Proto.Context, shape) records assert.json.shape and a messaging.contract.shape observation, naming the destination when the payload is empty or not JSON.
  • Capture — CaptureAttachments() records redacted published and matched payloads as message-publish-…/message-receive-… attachments; a capture failure is a messaging.attachment.failed event and never fails the operation.
  • Tracing — messaging.publish/messaging.await operations and messaging.publish/messaging.receive observations; 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 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.

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.

Version Downloads Last Updated
1.0.1 97 9/20/2026
1.0.0 89 9/20/2026