Table of Contents

Class EnsureArrangeExtensions

Namespace
Mokkit.Arrange
Assembly
Mokkit.dll

Ensure helpers for the Arrange phase. They derive a value (from a capture or an inline thunk), guard it as non-empty, and hand it back through a Mokkit.Trapture`1 that later Act/Inspect steps consume transparently. The derivation runs when the arrange chain executes, so the source capture is already populated by the time the value is read.

public static class EnsureArrangeExtensions

Inheritance

Inherited Members

Methods

Ensure<TSource, T>(ITestArrange, ICapture<TSource>, Func<TSource, T>, out Trapture<T>, string?)

Derives a value from an already-arranged capture, guards it as non-empty, and captures it into captured for use after the arrange chain is awaited.

public static ITestArrange Ensure<TSource, T>(this ITestArrange arrange, ICapture<TSource> source, Func<TSource, T> selector, out Trapture<T> captured, string? because = null) where TSource : class

Parameters

arrange ITestArrange

The arrange chain.

source ICapture<TSource>

The source capture to read once the chain runs.

selector Func<TSource, T>

Projects the derived value from the (non-null) source value.

captured Trapture<T>

Receives a transparent capture of the derived value.

because string?

Optional context appended to the failure message.

Returns

ITestArrange

The arrange chain for fluent chaining.

Type Parameters

TSource

The captured source type (e.g. an entity).

T

The derived value type (e.g. its id).

Ensure<T>(ITestArrange, Func<T>, out Trapture<T>, string?)

Evaluates a deferred thunk, guards its result as non-empty, and captures it into captured for use after the arrange chain is awaited. Use this when the value is derived from more than one capture.

public static ITestArrange Ensure<T>(this ITestArrange arrange, Func<T> selector, out Trapture<T> captured, string? because = null)

Parameters

arrange ITestArrange

The arrange chain.

selector Func<T>

A thunk evaluated when the chain runs (e.g. () => client.Value!.Id).

captured Trapture<T>

Receives a transparent capture of the derived value.

because string?

Optional context appended to the failure message.

Returns

ITestArrange

The arrange chain for fluent chaining.

Type Parameters

T

The derived value type.