Franz.Common.Testing 3.0.0

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

Franz.Common.Testing

Lightweight unit-test base class and test-only Mediator dispatcher helpers.

Overview

This package contains a reusable UnitTest base class and a lightweight in-memory TestDispatcher. It is a test utility package, not a production dispatcher or a complete replacement for the production Mediator runtime.

Installation

dotnet add package Franz.Common.Testing

UnitTest base class

Derive a test fixture from UnitTest to get a strict Moq MockRepository and a deterministic current/UI culture:

public sealed class CustomerServiceTests : UnitTest
{
    [Fact]
    public void Example()
    {
        var dependency = MockRepository.Create<ICustomerDependency>();
        // Arrange, act, assert.
    }
}

The default constructor uses the package's default culture. An overload accepts an explicit culture name. On disposal, the base class calls MockRepository.VerifyAll().

TestDispatcher

Franz.Common.Testing.Mediator.TestDispatcher supports direct registration of command, query, notification, and stream-query handlers, plus selected request/notification pipelines and pre/post-processors.

var dispatcher = new TestDispatcher()
    .WithHandler<GetCustomerQuery, CustomerDto>(handler);

var result = await dispatcher.SendAsync<CustomerDto>(
    new GetCustomerQuery(customerId),
    cancellationToken);

The dispatcher uses dynamic invocation and is annotated as requiring dynamic code and unreferenced members. It is intended for unit tests and is not Native AOT compatible.

Coverage boundary: the current implementation throws NotImplementedException for Send(INotification) and PublishEventAsync. Its non-generic SendAsync(ICommand) wrapper path also does not resolve the original command handler reliably. Do not use those paths in tests expecting production-equivalent dispatch. Use the production dispatcher in integration tests for behavior that depends on the full dispatch surface.

License

MIT. See the repository 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

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
3.0.0 33 11/10/2026
2.3.4 344 11/1/2026
2.3.3 95 10/28/2026
2.3.2 113 10/27/2026
2.3.1 98 10/26/2026
2.3.0 153 7/21/2026
2.2.19 128 7/19/2026
2.2.18 135 7/19/2026
2.2.17 135 7/12/2026
2.2.16 138 7/2/2026
2.2.15 132 6/29/2026
2.2.14 133 6/29/2026
2.2.13 139 6/29/2026
2.2.12 139 6/28/2026
2.2.11 145 6/28/2026
2.2.10 138 6/28/2026
2.2.9 159 6/28/2026
2.2.8 145 6/28/2026
2.2.7 152 6/7/2026
2.2.6 140 6/6/2026
Loading failed