Table of Contents

Namespace Trellis.Testing

Classes

AggregateTestMutator

Reflection-based helpers for setting source-generated Maybe<T> backing fields in test scenarios. Works on the CLR object directly — no DbContext needed for the mutation itself.

ErrorAssertions

Contains assertion methods for Error types.

ErrorAssertionsExtensions

Extension methods to enable FluentAssertions on Error types.

FakeRepository<TAggregate, TId>

In-memory fake repository for testing aggregates. Provides a simple in-memory store with domain event tracking.

FakeSharedResourceLoader<TResource, TId>

In-memory fake implementation of SharedResourceLoaderById<TResource, TId> that delegates to a FakeRepository<TAggregate, TId>. Use in application-layer tests to wire resource-based authorization without hand-writing a loader per command.

MaybeAssertionsExtensions

Extension methods to enable FluentAssertions on Maybe types.

MaybeAssertions<T>

Contains assertion methods for Maybe types.

ResultAssertionsAsyncExtensions

Extension methods to enable FluentAssertions on async Result types (Task and ValueTask).

ResultAssertionsExtensions

Extension methods to enable FluentAssertions on Result types.

ResultAssertions<TValue>

Contains assertion methods for Result types.

TestActorProvider

Mutable IActorProvider for integration and authorization testing. Stores the current actor in an AsyncLocal<T> so parallel tests using overlapping WithActor(Actor) scopes never interfere with each other.

TestActorScope

Captures the current Actor and restores it on dispose. Created by WithActor(Actor). Supports both await using and using patterns.

UnwrapExtensions

Provides Unwrap() extension methods for extracting values from Result<TValue> and Maybe<T> in test code. These methods throw a descriptive exception on failure/none rather than letting the test crash with an opaque error, keeping the test intent explicit.

UnwrapFailedException

Exception thrown when Unwrap<T>(Result<T>) or Unwrap<T>(Maybe<T>) is called on a failure/none value. Provides a descriptive message including the error details for test diagnostics.

ValidationErrorAssertions

Contains assertion methods for Error.UnprocessableContent.

ValidationErrorAssertionsExtensions

Extension methods to enable FluentAssertions on Error.UnprocessableContent.