HerrGeneral.Testing 1.7.0

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

HerrGeneral.Testing

Testing utilities and fluent assertions for HerrGeneral CQRS applications and unit tests.

Installation

dotnet add package HerrGeneral.Testing

Features & Usage

1. Fluent Command Dispatch & Result Assertions

Simplify unit and integration testing of mediator commands with extension methods that automatically execute the command and assert success or return the expected value:

using HerrGeneral.Testing;

// Dispatch and assert success
await new FreezeBankAccount(accountId).AssertSendFrom(mediator);

// Dispatch creation command and retrieve the resulting value (e.g., Guid ID)
Guid accountId = await new OpenBankAccount("John Doe").AssertSendFrom<Guid>(mediator);

2. Task & Result Assertions

Assert the outcome of asynchronous command executions directly:

using HerrGeneral.Testing;

// Assert success and unwrap value
var accountId = await mediator.Send<Guid>(new OpenBankAccount("Alice")).ShouldSuccess();

// Assert success with specific value
await mediator.Send<string>(new GetStatus(accountId)).ShouldSuccessWithValue("Active");

// Assert domain errors (business rule failures)
await mediator.Send(new DebitAccount(accountId, 1000m))
    .ShouldFailWithDomainErrorOfType<InsufficientFundsError>();

// Assert panic exceptions (technical exceptions)
await mediator.Send(new InvalidOperationCommand())
    .ShouldFailWithPanicExceptionOfType<InvalidOperationException>();

3. xUnit Test Output Logging

Integrate Microsoft.Extensions.Logging with xUnit's ITestOutputHelper during test execution:

using HerrGeneral.Testing;

services.AddHerrGeneralTestLogger(testOutputHelper, LogLevel.Debug);

When enabled, test runs produce a structured hierarchical causal tree in test output:

CMD [OpenBankAccount] (thread #4) ................................. [OK] (8.3ms)
 |
 \--> (cmd) OpenBankAccountHandler (0.5ms)
       |
       |-- (evt) AccountOpened
       |    \--> (wr) CreateDebitCardOnAccountOpened (3.1ms)
       |          \-- (evt) DebitCardCreated
       |
       \== [TX COMMIT] (1.2ms)
       |
       +-- [SYNC PROJECTIONS] (Read-Side)
       |    \-- AccountOpened                ===> AccountSummaryView           (1.1ms)
       |
       \-- [POST TRANSACTION] (Side Effects & Outbox)
            \-- AccountOpened                ===> SendWelcomeEmailSideEffect   (1.9ms)

Compatibility

  • Targets .NET 8.0, .NET 9.0, and .NET 10.0.
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
1.7.0 77 10/7/2026
1.6.0 78 10/5/2026
1.5.1-alpha.0.30 55 10/5/2026