Class Postprocessor

Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll

Performs post-processing on a created specimen.

public class Postprocessor : ISpecimenBuilderNode, ISpecimenBuilder, IEnumerable<ISpecimenBuilder>, IEnumerable

Inheritance

objectPostprocessor

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, ISpecimenCommand)

Initializes a new instance of the Postprocessor 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, ISpecimenCommand, IRequestSpecification)

Initializes a new instance of the Postprocessor 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

Properties

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 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()

public IEnumerator<ISpecimenBuilder> GetEnumerator()

Returns

IEnumerator<ISpecimenBuilder>