Methods

SpiedMethod

sealed

A spy on a void method: the real member runs, and each call the code under test makes that the selection matches is recorded. When it comes from a table, it covers its own instance only.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
CallList Calls { get; }The calls recorded, in the order the code under test made them.

SpiedMethod<TResult>

sealed

A spy on a method with a result: the real member runs, and each call the code under test makes that the selection matches is recorded. When it comes from a table, it covers its own instance only.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
CallList<TResult> Calls { get; }The calls recorded, in the order the code under test made them.

SpiedMethodTable<TInstance>

sealed

Spies on a void method on any instance: one spy per instance, reached by the instance.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
SpiedMethod this[TInstance instance]The spy of one instance's calls. Throws ArgumentNullException when the instance is null.
CallList Calls { get; }The calls recorded on every instance, in the order the code under test made them, each with its instance.

SpiedMethodTable<TInstance, TResult>

sealed

Spies on a method with a result on any instance: one spy per instance, reached by the instance.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
SpiedMethod<TResult> this[TInstance instance]The spy of one instance's calls. Throws ArgumentNullException when the instance is null.
CallList<TResult> Calls { get; }The calls recorded on every instance, in the order the code under test made them, each with its instance.

Constructors

SpiedConstructor<TResult>

sealed

A spy on a constructor: the real member runs, and each call the code under test makes that the selection matches is recorded.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
CallList<TResult> Calls { get; }The calls recorded, in the order the code under test made them.

Fields

SpiedField<TValue>

sealed

A spy on a field: the real member is read and written, and each read and write the code under test makes that the selection matches is recorded. A selection through a chain follows the instance the chain reaches at each access; when it comes from a table, it covers its own instance only.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
AccessList<TValue> Reads { get; }The reads recorded, in the order the code under test made them.
AccessList<TValue> Writes { get; }The writes recorded, in the order the code under test made them.

SpiedFieldTable<TInstance, TValue>

sealed

Spies on a field on any instance: one spy per instance, reached by the instance.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
SpiedField<TValue> this[TInstance instance]The spy of one instance. Throws ArgumentNullException when the instance is null.
AccessList<TValue> Reads { get; }The reads recorded on every instance, in the order the code under test made them, each with its instance.
AccessList<TValue> Writes { get; }The writes recorded on every instance, in the order the code under test made them, each with its instance.

Properties

SpiedProperty<TValue>

sealed

A spy on a property: the real member is read and written, and each read and write the code under test makes that the selection matches is recorded. A selection through a chain follows the instance the chain reaches at each access; when it comes from a table, it covers its own instance only.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
AccessList<TValue> Reads { get; }The reads recorded, in the order the code under test made them.
AccessList<TValue> Writes { get; }The writes recorded, in the order the code under test made them.

SpiedPropertyTable<TInstance, TValue>

sealed

Spies on a property on any instance: one spy per instance, reached by the instance.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
SpiedProperty<TValue> this[TInstance instance]The spy of one instance. Throws ArgumentNullException when the instance is null.
AccessList<TValue> Reads { get; }The reads recorded on every instance, in the order the code under test made them, each with its instance.
AccessList<TValue> Writes { get; }The writes recorded on every instance, in the order the code under test made them, each with its instance.

Indexers

SpiedIndexer<TValue>

sealed

A spy on an element written with []: the real member is read and written, and each read and write the code under test makes that the selection matches is recorded. A selection through a chain follows the instance the chain reaches at each access; when it comes from a table, it covers its own instance only.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
AccessList<TValue> Reads { get; }The reads recorded, in the order the code under test made them.
AccessList<TValue> Writes { get; }The writes recorded, in the order the code under test made them.

SpiedIndexerTable<TInstance, TValue>

sealed

Spies on an element written with [] on any instance: one spy per instance, reached by the instance.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
SpiedIndexer<TValue> this[TInstance instance]The spy of one instance. Throws ArgumentNullException when the instance is null.
AccessList<TValue> Reads { get; }The reads recorded on every instance, in the order the code under test made them, each with its instance.
AccessList<TValue> Writes { get; }The writes recorded on every instance, in the order the code under test made them, each with its instance.

Events

SpiedEvent

sealed

A spy on an event: the real event keeps its handlers, and the spy records the handlers the code under test subscribes and the raises it makes. Handlers are kept per instance: a selection through a chain follows the instance the chain reaches at each access; when it comes from a table, it covers its own instance only.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
IReadOnlyList<RecordedHandler> Handlers { get; }The handlers the code under test subscribed while this spy exists and has not unsubscribed, in subscription order.
IReadOnlyList<RecordedInvocation> Invocations { get; }The raises the code under test made, in order.

SpiedEventTable<TInstance>

sealed

Spies on an event on any instance: one spy per instance, reached by the instance.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
SpiedEvent this[TInstance instance]The spy of one instance's event. Throws ArgumentNullException when the instance is null.
IReadOnlyList<RecordedHandler> Handlers { get; }The handlers the code under test subscribed on every instance and has not unsubscribed, in subscription order, each with its instance.
IReadOnlyList<RecordedInvocation> Invocations { get; }The raises the code under test made on every instance, in order, each with its instance.

Catch blocks

SpiedCatch<TException>

sealed

A spy on catch blocks: it records every catch block the code under test enters with an exception of its type, subtypes included, while it exists. TException derives from Exception.

Every member throws InvalidOperationException once the test or fixture this spy belongs to has finished.

Members
IReadOnlyList<RecordedCatch> Catches { get; }The catch blocks entered, in order.