Class SubstituteRequestHandler
Namespace: AutoFixture.AutoNSubstitute
Assembly: AutoFixture.AutoNSubstitute.dll
Creates a substitute in response to the SubstituteRequest.
public class SubstituteRequestHandler : ISpecimenBuilderInheritance
object ← SubstituteRequestHandler
Implements
ISpecimenBuilder
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
This class serves as a fixture customization, responding to explicit substitute requests in the form of the
SubstituteRequest instances. The actual construction of the substitute is delegated to a
substitute factory, responsible for invoking an appropriate constructor for the target type with
automatically generated arguments.
Constructors
SubstituteRequestHandler(ISpecimenBuilder)
Initializes a new instance of the SubstituteRequestHandler class with the specified
substituteFactory.
public SubstituteRequestHandler(ISpecimenBuilder substituteFactory)Parameters
substituteFactory ISpecimenBuilder
An ISpecimenBuilder responsible for creating a substitute instance from a requested
Type.
Properties
SubstituteFactory
Returns an ISpecimenBuilder responsible for creating a substitute instance based on a target
Type type.
public ISpecimenBuilder SubstituteFactory { get; }Property Value
ISpecimenBuilder
Methods
Create(object, ISpecimenContext)
Creates a substitute when request is an explicit SubstituteRequest.
public object Create(object request, ISpecimenContext context)Parameters
request object
context ISpecimenContext
Returns
A substitute created by the SubstituteFactory when request is a
SubstituteRequest or NoSpecimen for all other requests.