Class SubstituteRequestHandler
Creates a substitute in response to the SubstituteRequest.
Inheritance
Implements
Inherited Members
Namespace: AutoFixture.AutoNSubstitute
Assembly: AutoFixture.AutoNSubstitute.dll
Syntax
public class SubstituteRequestHandler : ISpecimenBuilder
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
| Improve this Doc View SourceSubstituteRequestHandler(ISpecimenBuilder)
Initializes a new instance of the SubstituteRequestHandler class with the specified
substituteFactory
.
Declaration
public SubstituteRequestHandler(ISpecimenBuilder substituteFactory)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | substituteFactory | An ISpecimenBuilder responsible for creating a substitute instance from a requested System.Type. |
Properties
| Improve this Doc View SourceSubstituteFactory
Returns an ISpecimenBuilder responsible for creating a substitute instance based on a target System.Type type.
Declaration
public ISpecimenBuilder SubstituteFactory { get; }
Property Value
Type | Description |
---|---|
ISpecimenBuilder |
Methods
| Improve this Doc View SourceCreate(Object, ISpecimenContext)
Creates a substitute when request
is an explicit SubstituteRequest.
Declaration
public object Create(object request, ISpecimenContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Object | request | |
ISpecimenContext | context |
Returns
Type | Description |
---|---|
System.Object | A substitute created by the SubstituteFactory when |