Rig.TUnit.Microservices.Outbox 0.1.0-beta.2

This is a prerelease version of Rig.TUnit.Microservices.Outbox.
dotnet add package Rig.TUnit.Microservices.Outbox --version 0.1.0-beta.2
                    
NuGet\Install-Package Rig.TUnit.Microservices.Outbox -Version 0.1.0-beta.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="Rig.TUnit.Microservices.Outbox" Version="0.1.0-beta.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rig.TUnit.Microservices.Outbox" Version="0.1.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Rig.TUnit.Microservices.Outbox" />
                    
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 Rig.TUnit.Microservices.Outbox --version 0.1.0-beta.2
                    
#r "nuget: Rig.TUnit.Microservices.Outbox, 0.1.0-beta.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 Rig.TUnit.Microservices.Outbox@0.1.0-beta.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=Rig.TUnit.Microservices.Outbox&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rig.TUnit.Microservices.Outbox&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Tool

Rig.TUnit.Microservices.Outbox

Transactional-outbox testing helpers: OutboxFixture, OutboxRelaySimulator, OutboxAssert, OutboxReplay, + CustomOutboxStore<TRow> for plug-your-own-schema.

What this package is

The command-side outbox-pattern testing kit. OutboxFixture owns an IOutboxStore — either the default in-memory store (CAS-claim on read for exactly-once under concurrency) or your own row type wrapped in CustomOutboxStore<TRow>. OutboxRelaySimulator drains the pending messages through your publish delegate; OutboxAssert verifies a specific event type was enqueued and relayed; OutboxReplay simulates a crashed-relay scenario to test idempotency.

Exactly-once semantics validated under 100 concurrent relay runs against the in-memory store.

When to use it

  • Testing services that enqueue events inside the same transaction as the domain write.
  • Verifying relay idempotency after crash-recovery.
  • Asserting back-pressure / failure-handling under publish errors.
  • Not for: full end-to-end broker tests — layer with the matching Rig.TUnit.Messaging.* provider.

Prerequisites

  • .NET 10 SDK
  • If using CustomOutboxStore<TRow>: your persistence layer (EF Core, Dapper, Marten, …).

Quick start

using Rig.TUnit.Microservices.Outbox;

await using var fx = new OutboxFixture();
await fx.InitializeAsync();
await fx.Store.EnqueueAsync(new OutboxMessage(
    Guid.NewGuid(), "agg-1", "OrderPlaced", "{}", DateTimeOffset.UtcNow));

Options

Property Type Default Description
TableName string "Outbox" Schema table name for SQL stores
BatchSize int 100 Rows per ReadPendingAsync claim
ClaimTtl TimeSpan 5m How long a claimed row stays hidden
PublishRetries int 3 Retries on publish failure before dead-letter

Fixture + helper APIs

  • Rig.TUnit.Microservices.Outbox.Fixtures.OutboxFixture
  • Rig.TUnit.Microservices.Outbox.Stores.IOutboxStore
  • Rig.TUnit.Microservices.Outbox.Stores.CustomOutboxStore<TRow>
  • Rig.TUnit.Microservices.Outbox.Helpers.OutboxRelaySimulator
  • Rig.TUnit.Microservices.Outbox.Helpers.OutboxReplay
  • Rig.TUnit.Microservices.Outbox.Assertions.OutboxAssert
  • Rig.TUnit.Microservices.Outbox.Schema.OutboxSchema

Per-test isolation

OutboxFixture owns its store — in-memory is scoped per-fixture, and CustomOutboxStore<TRow> inherits the isolation of the persistence layer you plug in. IsolationKey can be used as the outbox table suffix for parallel SQL-backed runs.

Parallelism + performance

  • In-memory store: EnqueueAsync ~200 ns, ReadPendingAsync ~1 µs.
  • OutboxRelaySimulator.DrainAsync is sequential by design — exactly- once guarantees require CAS-claim + single-writer-per-batch.
  • Parallelism across fixtures: safe; each owns its store.

Troubleshooting

  • Duplicate publish — claim TTL expired before publish completed; a second relay picked up the row. Raise ClaimTtl or speed up the publish delegate.
  • OutboxAssert.Contains<T> reports not-found — the message's Type string doesn't match typeof(T).FullName; either rename or override GetTypeName(Type).

See docs/troubleshooting.md#outbox.

Provider quirks + edge cases

  • OutboxSchema ships pre-built parameterised SQL for the common cases (BuildInsertSql, BuildReadPendingSql(N), etc). Non-standard providers (Cosmos, Mongo) need custom implementations of IOutboxStore.
  • Relay simulator drains to exhaustion by default — large backlogs can slow tests. Use relay.DrainAsync(maxBatches: 10) for bounded runs.

Benchmarks

See OutboxBenchmarks.cs; baseline in benchmarks/baseline-005.json. Exactly-once-under-100- concurrent-relays is the marquee test.

License

MIT. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET 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 (2)

Showing the top 2 NuGet packages that depend on Rig.TUnit.Microservices.Outbox:

Package Downloads
Rig.TUnit.All

Meta-package containing every Rig.TUnit.* package. DISCOURAGED — prefer per-feature or per-stack meta-packages (Rig.TUnit, Rig.TUnit.Microservices).

Rig.TUnit.Microservices

Meta-package: Core + Mediator + Grpc + Outbox + Tracing + Jwt + Seq — the opinionated microservice testing kit.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-beta.2 45 4/27/2026
0.0.0-alpha.0.14 52 4/26/2026