Class Postprocessor<T>
Performs post-processing on a created specimen.
Inherited Members
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
[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
Name | Description |
---|---|
T | The type of specimen. |
Constructors
| Improve this Doc View SourcePostprocessor(ISpecimenBuilder, ISpecimenCommand)
Initializes a new instance of the Postprocessor<T> class.
Declaration
public Postprocessor(ISpecimenBuilder builder, ISpecimenCommand command)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | builder | The ISpecimenBuilder to decorate. |
ISpecimenCommand | command | The command to apply to the created specimen. |
Postprocessor(ISpecimenBuilder, ISpecimenCommand, IRequestSpecification)
Initializes a new instance of the Postprocessor<T> class.
Declaration
public Postprocessor(ISpecimenBuilder builder, ISpecimenCommand command, IRequestSpecification specification)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | builder | The ISpecimenBuilder to decorate. |
ISpecimenCommand | command | The command to apply to the created specimen. |
IRequestSpecification | specification | A specification which is used to determine whether postprocessing should be performed for a request. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | builder, command, or specification is null. |
Postprocessor(ISpecimenBuilder, Action<T, ISpecimenContext>)
Initializes a new instance of the Postprocessor<T> class with the supplied parameters.
Declaration
[Obsolete("Use Postprocessor(ISpecimenBuilder, ISpecimenCommand) instead", true)]
public Postprocessor(ISpecimenBuilder builder, Action<T, ISpecimenContext> action)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | builder | The ISpecimenBuilder to decorate. |
System.Action<T, ISpecimenContext> | action | The action to perform on the created specimen. |
Postprocessor(ISpecimenBuilder, Action<T, ISpecimenContext>, IRequestSpecification)
Initializes a new instance of the Postprocessor<T> class with the supplied parameters.
Declaration
[Obsolete("Use Postprocessor(ISpecimenBuilder, ISpecimenCommand, IRequestSpecification) instead", true)]
public Postprocessor(ISpecimenBuilder builder, Action<T, ISpecimenContext> action, IRequestSpecification specification)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | builder | The ISpecimenBuilder to decorate. |
System.Action<T, ISpecimenContext> | action | The action to perform on the created specimen. |
IRequestSpecification | specification | A specification which is used to determine whether postprocessing should be performed for a request. |
Postprocessor(ISpecimenBuilder, Action<T>)
Initializes a new instance of the Postprocessor<T> class with the supplied parameters.
Declaration
[Obsolete("Use Postprocessor(ISpecimenBuilder, ISpecimenCommand) instead", true)]
public Postprocessor(ISpecimenBuilder builder, Action<T> action)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | builder | The ISpecimenBuilder to decorate. |
System.Action<T> | action | The action to perform on the created specimen. |
Properties
| Improve this Doc View SourceAction
Gets the action to perform on created specimens.
Declaration
[Obsolete("Use the Command property instead.", true)]
public Action<T, ISpecimenContext> Action { get; }
Property Value
Type | Description |
---|---|
System.Action<T, ISpecimenContext> |
Builder
Gets the decorated builder.
Declaration
public ISpecimenBuilder Builder { get; }
Property Value
Type | Description |
---|---|
ISpecimenBuilder |
Command
Gets the command, which is applied during postprocessing.
Declaration
public ISpecimenCommand Command { get; }
Property Value
Type | Description |
---|---|
ISpecimenCommand | The command supplied via one of the constructors. |
Specification
Gets the filter that determines whether Command should be executed.
Declaration
public IRequestSpecification Specification { get; }
Property Value
Type | Description |
---|---|
IRequestSpecification |
Methods
| Improve this Doc View SourceCompose(IEnumerable<ISpecimenBuilder>)
Composes the supplied builders.
Declaration
public virtual ISpecimenBuilderNode Compose(IEnumerable<ISpecimenBuilder> builders)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ISpecimenBuilder> | builders | The builders to compose. |
Returns
Type | Description |
---|---|
ISpecimenBuilderNode | A new ISpecimenBuilderNode instance containing
|
Create(Object, ISpecimenContext)
Creates a new specimen based on a request and performs an action on the created specimen.
Declaration
public object Create(object request, ISpecimenContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Object | request | The request that describes what to create. |
ISpecimenContext | context | A context that can be used to create other specimens. |
Returns
Type | Description |
---|---|
System.Object | The requested specimen if possible; otherwise a NoSpecimen instance. |
Remarks
The request
can be any object, but will often be a
System.Type or other System.Reflection.MemberInfo instances.
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<ISpecimenBuilder> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<ISpecimenBuilder> | A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection. |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |