Trellis.Testing 3.0.0-alpha.721

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

Trellis.Testing

NuGet Package

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, and Forbidden makes 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, SelectExactly with failures that name every offending candidate
  • Actors and authorization — actor.Should().HavePermission(...) (forbidden overrides granted), IAuthorize ShouldBeAuthorizedFor / ShouldNotBeAuthorizedFor, and TestActorProvider.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 Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed