Trellis.Testing
3.0.0-alpha.721
dotnet add package Trellis.Testing --version 3.0.0-alpha.721
NuGet\Install-Package Trellis.Testing -Version 3.0.0-alpha.721
<PackageReference Include="Trellis.Testing" Version="3.0.0-alpha.721" />
<PackageVersion Include="Trellis.Testing" Version="3.0.0-alpha.721" />
<PackageReference Include="Trellis.Testing" />
paket add Trellis.Testing --version 3.0.0-alpha.721
#r "nuget: Trellis.Testing, 3.0.0-alpha.721"
#:package Trellis.Testing@3.0.0-alpha.721
#addin nuget:?package=Trellis.Testing&version=3.0.0-alpha.721&prerelease
#tool nuget:?package=Trellis.Testing&version=3.0.0-alpha.721&prerelease
Trellis.Testing
FluentAssertions extensions and test doubles that make Result and Maybe tests read like intent instead of plumbing.
Installation
dotnet add package Trellis.Testing
Quick Example
using FluentAssertions;
using Trellis;
using Trellis.Testing;
var result = Result.Ok(42);
var maybe = Maybe.From("Ada");
result.Should().BeSuccess().Which.Should().Be(42);
maybe.Should().HaveValue().Which.Should().Be("Ada");
Key Features
- Result assertions —
BeSuccess(),BeFailure(),BeFailureOfType<T>(), async variants - Maybe assertions —
HaveValue(),BeNone(),HaveValueEqualTo() - Error/Error.InvalidInput assertions —
HaveCode(),HaveFieldError() - Unwrap helpers — Extract values in test code without analyzer warnings
- FakeRepository — In-memory aggregate store with domain event tracking
- FakeUnitOfWork — Configurable commit results, call/attempt counters, and deferred nested commits
- TestActorProvider — Mutable actor/identity provider with shared async-flow scoping
- Identity agreement —
await actorProvider.ShouldHaveConsistentActorIdentityAsync(identityProvider, ct)compares sequential resolutions with provider-specific diagnostics - Structured validation — Match full pointers/reason codes, count violations, or assert exact field/rule payload multisets with typed arguments
- Persistence intent —
HavePersistOnFailure(bool)on typed and interface result assertions - Callback recording —
CallbackRecorder/CallbackRecorder<TArgument>record counts and ordered argument snapshots without changing callback outcomes;Should().HaveBeenCalledOnce()and siblings assert call counts, andForbiddenmakes a callback that must never run fail loudly - Controlled async sources —
ControlledAsync<T>is a pending source you complete, fault or cancel;ControlledAsync.SingleUse<T>()also proves a ValueTask is consumed exactly once - Async assertions —
ShouldBePendingThenReleaseAsync(pending check, guaranteed release, bounded wait),ShouldPropagateExceptionAsync/ShouldPropagateCancellationAsync(original exception or token unchanged),CanceledToken, and null-guard checks that name the parameter (ShouldRejectNull*) - Domain events —
aggregate.UncommittedEvents().Should().HaveRaised<TEvent>(),NotHaveRaised,HaveRaisedCount,HaveRaisedExactlyInOrder - Pagination —
page.Should().HaveItems(...),HaveNextCursor(),BeLastPage(),HaveAppliedLimit(...),BeCapped() - Specifications —
spec.Should().BeSatisfiedBy(x),BeSatisfiedByAll,SelectExactlywith failures that name every offending candidate - Actors and authorization —
actor.Should().HavePermission(...)(forbidden overrides granted),IAuthorizeShouldBeAuthorizedFor/ShouldNotBeAuthorizedFor, andTestActorProvider.Anonymous()/WithoutActor()for unauthenticated paths - Bounded async assertions — Existing success/failure assertions accept an explicit timeout and cancellation token without canceling the source operation
FakeUnitOfWork implements provider-neutral IUnitOfWork without EF Core or Mediator.
It tests commit decisions and scope ownership, not persistence atomicity or rollback.
See the full documentation for setup and counter semantics.
For ASP.NET Core integration test helpers (WebApplicationFactory, DI replacement), see Trellis.Testing.AspNetCore.
Documentation
Part of Trellis
This package is part of the Trellis framework.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- FluentAssertions (>= 7.2.2)
- OpenTelemetry.Api (>= 1.20.1)
- Trellis.Authorization (>= 3.0.0-alpha.721)
- Trellis.Core (>= 3.0.0-alpha.721)
- Trellis.Persistence.Abstractions (>= 3.0.0-alpha.721)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Trellis.Testing:
| Package | Downloads |
|---|---|
|
Trellis.Testing.AspNetCore
ASP.NET Core integration test utilities for Trellis - WebApplicationFactory helpers, DI service replacement, fake time providers, and MSAL token acquisition |
|
|
Trellis.Testing.Worker
Integration-test harness for BackgroundService workers built on Trellis - prewired IHost, FakeTimeProvider, TestActorProvider, domain-event capture, and tick-completion primitives |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0-alpha.721 | 53 | 11/15/2026 |
| 3.0.0-alpha.582 | 180 | 10/19/2026 |
| 3.0.0-alpha.574 | 265 | 10/14/2026 |
| 3.0.0-alpha.571 | 89 | 10/13/2026 |
| 3.0.0-alpha.557 | 156 | 10/8/2026 |
| 3.0.0-alpha.554 | 121 | 10/8/2026 |
| 3.0.0-alpha.553 | 76 | 10/7/2026 |
| 3.0.0-alpha.542 | 125 | 10/5/2026 |
| 3.0.0-alpha.539 | 93 | 10/4/2026 |
| 3.0.0-alpha.532 | 124 | 10/2/2026 |
| 3.0.0-alpha.527 | 100 | 10/1/2026 |
| 3.0.0-alpha.526 | 72 | 9/30/2026 |
| 3.0.0-alpha.524 | 79 | 9/27/2026 |
| 3.0.0-alpha.520 | 96 | 9/25/2026 |
| 3.0.0-alpha.516 | 232 | 9/22/2026 |
| 3.0.0-alpha.513 | 79 | 9/22/2026 |
| 3.0.0-alpha.505 | 202 | 9/13/2026 |
| 3.0.0-alpha.495 | 256 | 8/24/2026 |
| 3.0.0-alpha.458 | 228 | 8/19/2026 |
| 3.0.0-alpha.455 | 182 | 8/19/2026 |