Momentum.Testing 0.9.0

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

Momentum.Testing

The test harness for Momentum, an event-driven, multi-tenant workflow framework for .NET:

  • FlowTestHarness — auto-discovers your generated steps and cascades events through them in memory: publish an event, assert on ExecutedSteps, PublishedEvents, DeadLetters
  • Retry/dead-letter simulation mirroring the runtime's semantics
  • InMemoryBus / InMemoryMomentumPublisher — capture internal and external publishes
  • ScheduledEvents / AdvanceTimeAsync — inspect deadlines and advance virtual time across API calls and handler cascades
  • Cron helpers — validate a step's Quartz schedule and fire it as the scheduler would

No database, broker, or application host is required; flow tests run in memory.

Install

dotnet add package Momentum.Testing

Flow test

using Momentum.Testing;

[Fact]
public async Task Published_event_runs_the_registered_handler()
{
    using var harness = new FlowTestHarness(autoDiscover: false);
    var handled = false;

    harness.RegisterHandler<UserCreated>((evt, _) =>
    {
        handled = true;
        return Task.CompletedTask;
    });

    await harness.Bus.PublishAsync(new UserCreated(Guid.NewGuid(), "user@example.com")
    {
        TenantId = Guid.NewGuid()
    });

    Assert.True(handled);
    Assert.Single(harness.GetPublished<UserCreated>());
}

Auto-discovery is enabled by default and loads generated StepRegistration metadata from referenced step assemblies. It fails loudly when no registration can be found; assert DiscoveredHandlerCount when you want to pin the discovered topology.

The harness records executed steps, returned StepResult values, published internal and external events, retry attempts, and simulated dead letters. Use TriggerCronStepAsync(typeof(MyCronStep)) to validate and execute a cron definition without starting Quartz.

Scheduled events

harness.Bus.ScheduleAsync(message, delay) queues a deadline without delivering it immediately. Inspect harness.ScheduledEvents, then call await harness.AdvanceTimeAsync(delay) to execute due handlers without sleeping. The same virtual clock is shared across API calls and handler cascades, including retry simulation. PostgreSQL integration tests are still needed to verify business transaction rollback and durable recovery.

License

Momentum is free for qualifying non-commercial open-source projects. Commercial use requires a separate written license agreement. The complete terms are included in the package.

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
0.9.0 67 10/1/2026
0.8.2 149 9/13/2026
0.8.1 93 9/12/2026
0.8.0 94 9/12/2026
0.7.2 103 9/1/2026
0.7.1 106 8/28/2026