Class Postprocessor<T>

Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll

Performs post-processing on a created specimen.

[Obsolete("The generic version of the Postprocessor is no longer used and will be removed in future versions. Please use the non-generic version of the Postprocessor type.")]
public class Postprocessor<T> : ISpecimenBuilderNode, ISpecimenBuilder, IEnumerable<ISpecimenBuilder>, IEnumerable

Type Parameters

T

The type of specimen.

Inheritance

objectPostprocessor<T>

Implements

ISpecimenBuilderNode, ISpecimenBuilder, IEnumerable<ISpecimenBuilder>, IEnumerable

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Extension Methods

SpecimenFactory.Create<T>(ISpecimenBuilder), SpecimenFactory.CreateMany<T>(ISpecimenBuilder), SpecimenFactory.CreateMany<T>(ISpecimenBuilder, int), SpecimenCommand.Do<T>(ISpecimenBuilder, Action<T>), SpecimenCommand.Do<T1, T2>(ISpecimenBuilder, Action<T1, T2>), SpecimenCommand.Do<T1, T2, T3>(ISpecimenBuilder, Action<T1, T2, T3>), SpecimenCommand.Do<T1, T2, T3, T4>(ISpecimenBuilder, Action<T1, T2, T3, T4>), SpecimenQuery.Get<T, TResult>(ISpecimenBuilder, Func<T, TResult>), SpecimenQuery.Get<T1, T2, TResult>(ISpecimenBuilder, Func<T1, T2, TResult>), SpecimenQuery.Get<T1, T2, T3, TResult>(ISpecimenBuilder, Func<T1, T2, T3, TResult>), SpecimenQuery.Get<T1, T2, T3, T4, TResult>(ISpecimenBuilder, Func<T1, T2, T3, T4, TResult>), SpecimenBuilderNode.GraphEquals(ISpecimenBuilderNode, ISpecimenBuilderNode), SpecimenBuilderNode.GraphEquals(ISpecimenBuilderNode, ISpecimenBuilderNode, IEqualityComparer<ISpecimenBuilder>), CustomizationExtensions.ToCustomization(ISpecimenBuilder)

Constructors

Postprocessor(ISpecimenBuilder, Action<T>)

Initializes a new instance of the Postprocessor%601 class with the supplied parameters.

[Obsolete("Use Postprocessor(ISpecimenBuilder, ISpecimenCommand) instead", true)]
public Postprocessor(ISpecimenBuilder builder, Action<T> action)

Parameters

builder ISpecimenBuilder

The ISpecimenBuilder to decorate.

action Action<T>

The action to perform on the created specimen.

Postprocessor(ISpecimenBuilder, Action<T, ISpecimenContext>)

Initializes a new instance of the Postprocessor%601 class with the supplied parameters.

[Obsolete("Use Postprocessor(ISpecimenBuilder, ISpecimenCommand) instead", true)]
public Postprocessor(ISpecimenBuilder builder, Action<T, ISpecimenContext> action)

Parameters

builder ISpecimenBuilder

The ISpecimenBuilder to decorate.

action Action<T, ISpecimenContext>

The action to perform on the created specimen.

Postprocessor(ISpecimenBuilder, ISpecimenCommand)

Initializes a new instance of the Postprocessor%601 class.

public Postprocessor(ISpecimenBuilder builder, ISpecimenCommand command)

Parameters

builder ISpecimenBuilder

The ISpecimenBuilder to decorate.

command ISpecimenCommand

The command to apply to the created specimen.

Postprocessor(ISpecimenBuilder, Action<T, ISpecimenContext>, IRequestSpecification)

Initializes a new instance of the Postprocessor%601 class with the supplied parameters.

[Obsolete("Use Postprocessor(ISpecimenBuilder, ISpecimenCommand, IRequestSpecification) instead", true)]
public Postprocessor(ISpecimenBuilder builder, Action<T, ISpecimenContext> action, IRequestSpecification specification)

Parameters

builder ISpecimenBuilder

The ISpecimenBuilder to decorate.

action Action<T, ISpecimenContext>

The action to perform on the created specimen.

specification IRequestSpecification

A specification which is used to determine whether postprocessing should be performed for a request.

Postprocessor(ISpecimenBuilder, ISpecimenCommand, IRequestSpecification)

Initializes a new instance of the Postprocessor%601 class.

public Postprocessor(ISpecimenBuilder builder, ISpecimenCommand command, IRequestSpecification specification)

Parameters

builder ISpecimenBuilder

The ISpecimenBuilder to decorate.

command ISpecimenCommand

The command to apply to the created specimen.

specification IRequestSpecification

A specification which is used to determine whether postprocessing should be performed for a request.

Exceptions

ArgumentNullException

builder, command, or specification is null.

Properties

Action

Gets the action to perform on created specimens.

[Obsolete("Use the Command property instead.", true)]
public Action<T, ISpecimenContext> Action { get; }

Property Value

Action<T, ISpecimenContext>

Builder

Gets the decorated builder.

public ISpecimenBuilder Builder { get; }

Property Value

ISpecimenBuilder

Command

Gets the command, which is applied during postprocessing.

public ISpecimenCommand Command { get; }

Property Value

ISpecimenCommand

Specification

Gets the filter that determines whether Command should be executed.

public IRequestSpecification Specification { get; }

Property Value

IRequestSpecification

Methods

Compose(IEnumerable<ISpecimenBuilder>)

Composes the supplied builders.

public virtual ISpecimenBuilderNode Compose(IEnumerable<ISpecimenBuilder> builders)

Parameters

builders IEnumerable<ISpecimenBuilder>

The builders to compose.

Returns

ISpecimenBuilderNode

A new ISpecimenBuilderNode instance containing builders as child nodes.

Create(object, ISpecimenContext)

Creates a new specimen based on a request and performs an action on the created specimen.

public object Create(object request, ISpecimenContext context)

Parameters

request object

The request that describes what to create.

context ISpecimenContext

A context that can be used to create other specimens.

Returns

object

The requested specimen if possible; otherwise a NoSpecimen instance.

Remarks

The request can be any object, but will often be a `Type` or other `MemberInfo` instances.

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<ISpecimenBuilder> GetEnumerator()

Returns

IEnumerator<ISpecimenBuilder>

A IEnumerator%601 that can be used to iterate through the collection.