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

This is a prerelease version of Rig.TUnit.Microservices.Inbox.
dotnet add package Rig.TUnit.Microservices.Inbox --version 0.1.0-beta.2
                    
NuGet\Install-Package Rig.TUnit.Microservices.Inbox -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.Inbox" 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.Inbox" Version="0.1.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Rig.TUnit.Microservices.Inbox" />
                    
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.Inbox --version 0.1.0-beta.2
                    
#r "nuget: Rig.TUnit.Microservices.Inbox, 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.Inbox@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.Inbox&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rig.TUnit.Microservices.Inbox&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Tool

Rig.TUnit.Microservices.Inbox

Inbox pattern — per-aggregate sequence tracking for idempotent event application. SequenceTracker + fluent InboxAssert.SequenceApplied(…).Idempotent().

What this package is

The query-side idempotency helper for event-sourced microservices. SequenceTracker keeps a per-aggregate "highest applied sequence" record; TryApply(aggregateId, sequence) returns true only for strictly-increasing sequences. Duplicates and out-of-order events are rejected. InboxAssert offers the fluent assertion shape tests expect.

When to use it

  • Testing event-handler idempotency.
  • Verifying out-of-order events are rejected.
  • Regression-guarding "at-least-once delivery" correctness after a consumer rewrite.
  • Not for: integration testing of a real DB-backed inbox — extend SequenceTracker with your persistence adapter.

Prerequisites

  • .NET 10 SDK

Quick start

using Rig.TUnit.Microservices.Inbox;

var tracker = new SequenceTracker();
tracker.TryApply("agg-1", 5);          // true
tracker.TryApply("agg-1", 5);          // false — idempotent re-apply
tracker.TryApply("agg-1", 4);          // false — out of order

InboxAssert.SequenceApplied(tracker, "agg-1", 5).Idempotent();

Options

Property Type Default Description
MaxTrackedAggregates int 10_000 Guard against unbounded growth
EvictionPolicy InboxEvictionPolicy OldestFirst How to reclaim slots when full

Fixture + helper APIs

  • Rig.TUnit.Microservices.Inbox.SequenceTracker
  • Rig.TUnit.Microservices.Inbox.Assertions.InboxAssert

Per-test isolation

Each SequenceTracker instance is scoped per-test. No shared statics. Safe under full parallelism.

Parallelism + performance

  • TryApply is a dictionary lookup + CAS: ~50 ns per call.
  • Thread-safe via ConcurrentDictionary; safe under full parallelism.

Troubleshooting

  • TryApply returns true for a duplicate — the aggregate-id string is different (case, whitespace). SequenceTracker is case-sensitive by design; normalise at your persistence boundary.

See docs/troubleshooting.md#inbox.

Provider quirks + edge cases

  • Sequence numbers are long; negative sequences throw ArgumentOutOfRangeException.
  • Gaps are not detected — TryApply(5) after TryApply(3) returns true, and the tracker advances. That is the correct semantic for most inbox patterns (gaps are the publisher's problem).

Benchmarks

See InboxBenchmarks.cs; baseline in benchmarks/baseline-005.json.

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.Inbox:

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 49 4/27/2026
0.0.0-alpha.0.14 50 4/26/2026