redb.Route.TestKit 4.2.2

Prefix Reserved
dotnet add package redb.Route.TestKit --version 4.2.2
                    
NuGet\Install-Package redb.Route.TestKit -Version 4.2.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="redb.Route.TestKit" Version="4.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="redb.Route.TestKit" Version="4.2.2" />
                    
Directory.Packages.props
<PackageReference Include="redb.Route.TestKit" />
                    
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 redb.Route.TestKit --version 4.2.2
                    
#r "nuget: redb.Route.TestKit, 4.2.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 redb.Route.TestKit@4.2.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=redb.Route.TestKit&version=4.2.2
                    
Install as a Cake Addin
#tool nuget:?package=redb.Route.TestKit&version=4.2.2
                    
Install as a Cake Tool

redb.Route.TestKit

Test a route without its brokers, without changing the route. Works with xUnit, NUnit and MSTest: assertions throw MockAssertionException, no test-framework dependency.

await using var ctx = new RouteContext().AddRoutes(new OrdersRoutes());

ctx.AdviceRoute("orders", a => a
    .ReplaceFrom("direct://test-in")            // instead of kafka://orders
    .MockEndpoints("kafka://*", "sql:*"));      // every matching To(...) goes to a mock

await ctx.Start();

var vip = ctx.Mock("kafka://orders-vip");
vip.ExpectMessageCount(1).ExpectHeader("priority", "high");

await ctx.SendBody("direct://test-in", order);
await vip.AssertIsSatisfiedAsync(TimeSpan.FromSeconds(2));

What is inside

API Purpose
ctx.AdviceRoute(routeId, a => ...) rewrite a route definition before Start(): ReplaceFrom, MockEndpoints, MockEndpointsAndSkip, WeaveById, WeaveByToUri, WeaveAddFirst, WeaveAddLast
ctx.Mock(uri) the MockEndpoint standing in for uri (original URI or mock://name)
MockEndpoint.Expect* ExpectMessageCount, ExpectMinimumMessageCount, ExpectBodies, ExpectBodiesInAnyOrder, ExpectHeader, ExpectHeaderReceived, ExpectProperty, Expect(predicate / condition string)
MockEndpoint.AssertIsSatisfiedAsync(timeout) waits, then fails with an "Expected / but was" diff and the bodies received
MockEndpoint.Whenever(n) / WheneverAny() scripted replies: SetBody, SetHeader, Delay, Throw, Do — for Enrich and request-reply through mock://
ctx.Notify().FromRoute("orders").WhenDone(3).Create() wait for route events (WhenReceived, WhenCompleted, WhenFailed, WhenDone, From(uriMask), Filter(condition)) without a mock at the end
ctx.SendBody, ctx.SendBodyAndHeaders, ctx.RequestBody<T> one-line sends instead of endpoint/producer plumbing

URI masks (MockEndpoints, WeaveByToUri, Notify().From): exact URI, prefix with a trailing * (kafka://*), or regex:<expression>. Query strings are ignored for matching.

MockEndpoints rewrites the static To(...) steps of the advised route; a dynamic ToD(...) resolves its URI per message and is not rewritten — point it at a mock:// URI through the message instead.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.2.2 0 10/5/2026
4.2.0 78 9/30/2026
4.1.1 85 9/25/2026
4.1.0 83 9/21/2026
4.0.1 89 9/18/2026
4.0.0 96 9/11/2026