Table of Contents

Interface ICapture<T>

Namespace
Mokkit
Assembly
Mokkit.dll

Read-only contract shared by Mokkit.Capture`1 and Mokkit.Trapture`1. Exposes the captured value once it has been set by the capture system.

public interface ICapture<out T>

Type Parameters

T

The type of the captured value.

Properties

EnsureValue

Gets the captured value, guarded — client.EnsureValue instead of client.Value!, so the null-forgiving operator stays out of tests. This is the capture-level member of the Ensure family and applies the same definition of "empty": a capture that was never filled, or one holding null / "" / 0 / System.Guid.Empty / an empty collection, fails loudly here rather than letting a bogus value flow onward.

T EnsureValue { get; }

Property Value

T

Exceptions

InvalidOperationException

Thrown when the capture is unfilled or its value is empty.

Value

Gets the captured value, or the type default (null for reference types) if no value has been captured yet.

T? Value { get; }

Property Value

T?

Methods

Prop<TProp>(Func<T, TProp>)

Reads a member off the captured value — client.Prop(c => c.Id) instead of client.Value!.Id. Equivalent to propFn(EnsureValue): the capture is guarded, the projected member is handed back as-is (so a nullable member may still come back null).

TProp? Prop<TProp>(Func<out T, TProp> propFn)

Parameters

propFn Func<T, TProp>

Projects the member from the guarded captured value.

Returns

TProp?

The projected member, which may itself be null if the member is nullable.

Type Parameters

TProp

The type of the member being read.

Exceptions

ArgumentNullException

Thrown when propFn is null.

InvalidOperationException

Thrown when the capture is unfilled or its value is empty.