Hyperbee.Pipeline.TestHelpers
3.0.0
dotnet add package Hyperbee.Pipeline.TestHelpers --version 3.0.0
NuGet\Install-Package Hyperbee.Pipeline.TestHelpers -Version 3.0.0
<PackageReference Include="Hyperbee.Pipeline.TestHelpers" Version="3.0.0" />
<PackageVersion Include="Hyperbee.Pipeline.TestHelpers" Version="3.0.0" />
<PackageReference Include="Hyperbee.Pipeline.TestHelpers" />
paket add Hyperbee.Pipeline.TestHelpers --version 3.0.0
#r "nuget: Hyperbee.Pipeline.TestHelpers, 3.0.0"
#:package Hyperbee.Pipeline.TestHelpers@3.0.0
#addin nuget:?package=Hyperbee.Pipeline.TestHelpers&version=3.0.0
#tool nuget:?package=Hyperbee.Pipeline.TestHelpers&version=3.0.0
Hyperbee.Pipeline.TestHelpers
The Hyperbee.Pipeline.TestHelpers library provides test fixtures and helpers for unit testing
Hyperbee.Pipeline commands with FluentValidation and NSubstitute.
Examples
Create a Test Pipeline Context
// Default context with no validators
var factory = PipelineContextFactoryFixture.Default();
// Context with validators
var factory = new PipelineContextFactoryFixture()
.WithValidator<OrderInput, OrderInputValidator>()
.Create();
Test a Command
[Fact]
public async Task Should_return_result_when_input_is_valid()
{
var factory = new PipelineContextFactoryFixture()
.WithValidator<OrderInput, OrderInputValidator>()
.Create();
var logger = Substitute.For<ILogger<CreateOrderCommand>>();
var command = new CreateOrderCommand( factory, logger );
var (ctx, result) = await command.ExecuteAsync( new OrderInput { Name = "Widget" } );
Assert.Null( ctx.Exception );
Assert.NotNull( result );
}
Mock a Command Procedure
ICommandProcedure<TStart> commands have no output. Mock them the same way as command functions:
var procedure = Substitute.For<ICommandProcedure<OrderInput>>();
// Successful (no-output) result
procedure.MockSuccessfulResult();
// Or an error result whose ThrowIfError() throws
procedure.MockExceptionCommandResult( new InvalidOperationException( "failed" ) );
var result = await procedure.ExecuteAsync( new OrderInput { Name = "Widget" } );
Assert.False( result.Context.IsError );
Register a Middleware Provider
// Set a default provider for all tests (e.g., in [AssemblyInitialize])
PipelineContextFactoryFixture.DefaultMiddlewareProvider = new LoggingMiddlewareProvider();
// Every fixture automatically includes it
var factory = PipelineContextFactoryFixture.Default();
// Or register per-fixture (overrides the default)
var factory = new PipelineContextFactoryFixture()
.WithMiddlewareProvider<LoggingMiddlewareProvider>()
.Create();
// Or with an instance
var factory = new PipelineContextFactoryFixture()
.WithMiddlewareProvider( new LoggingMiddlewareProvider( logger ) )
.Create();
Register Custom Services
var factory = new PipelineContextFactoryFixture()
.WithValidator<OrderInput, OrderInputValidator>()
.WithServices( services =>
{
services.AddSingleton( mockRepository );
services.AddSingleton<IDateTimeProvider>( mockDateTimeProvider );
} )
.Create();
Mock Command Functions
var command = Substitute.For<ICommandFunction<Guid, Order>>();
// Mock a successful result
command.MockSuccessfulResult( new Order { Id = Guid.NewGuid(), Name = "Widget" } );
// Mock a validation failure
command.MockValidationFailureResult<Guid, Order>(
new ValidationFailure( "Name", "Name is required." ) );
// Mock an exception
command.MockExceptionCommandResult<Guid, Order>(
new InvalidOperationException( "Something went wrong." ) );
Create Command Results Directly
var success = CommandResultHelpers.CreateSuccess( new Order { Name = "Widget" } );
var failure = CommandResultHelpers.CreateValidationFailure<Order>(
new ValidationFailure( "Name", "Name is required." ) );
var exception = CommandResultHelpers.CreateWithException<Order>(
new InvalidOperationException( "Something went wrong." ) );
Target frameworks
net11.0, net10.0, netstandard2.1. A net8.0 or net9.0 project resolves the
netstandard2.1 asset; see the repository README.
On netstandard2.1 this package depends on FluentValidation 11.12, the last release line
with a netstandard2.1 asset. net10.0 and net11.0 use FluentValidation 12.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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 was computed. 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. net11.0 is compatible. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- FluentValidation (>= 11.12.0)
- Hyperbee.Pipeline.Validation.FluentValidation (>= 3.0.0)
- NSubstitute (>= 5.3.0)
-
net10.0
- FluentValidation (>= 12.1.1)
- Hyperbee.Pipeline.Validation.FluentValidation (>= 3.0.0)
- NSubstitute (>= 5.3.0)
-
net11.0
- FluentValidation (>= 12.1.1)
- Hyperbee.Pipeline.Validation.FluentValidation (>= 3.0.0)
- NSubstitute (>= 5.3.0)
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 | 103 | 11/28/2026 |
| 2.16.1 | 103 | 11/26/2026 |
| 2.16.0 | 103 | 11/26/2026 |
| 2.15.0 | 4,927 | 7/15/2026 |
| 2.14.0 | 1,984 | 6/8/2026 |
| 2.13.0 | 460 | 5/19/2026 |
| 2.12.0 | 1,088 | 4/12/2026 |
| 2.11.1 | 149 | 3/26/2026 |
| 2.10.1-alpha-gc6f6d9837f | 133 | 3/25/2026 |
| 2.9.1 | 2,243 | 3/19/2026 |
| 2.9.0 | 134 | 3/19/2026 |
| 2.8.2 | 167 | 3/16/2026 |
| 2.7.0 | 2,467 | 2/28/2026 |
| 2.6.0 | 146 | 2/28/2026 |
| 2.5.0 | 149 | 2/28/2026 |
| 2.4.0 | 145 | 2/27/2026 |
| 2.3.3 | 4,172 | 2/24/2026 |
| 2.3.2 | 504 | 2/18/2026 |
| 2.3.1 | 149 | 2/18/2026 |
| 2.3.0 | 138 | 2/17/2026 |