Class SubstituteRelay
Relays a request for an interface or an abstract class to a request for a substitute of that type.
Inheritance
System.Object
SubstituteRelay
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: AutoFixture.AutoNSubstitute
Assembly: AutoFixture.AutoNSubstitute.dll
Syntax
public class SubstituteRelay : ISpecimenBuilder
Remarks
This class serves as a residue collector, catching unanswered requests for an instance of an abstract type and converting them to requests for a substitute of that type, dynamically generated by NSubstitute.
Constructors
| Improve this Doc View SourceSubstituteRelay()
Creates a new instance of SubstituteRelay.
Declaration
public SubstituteRelay()
SubstituteRelay(IRequestSpecification)
Creates a new instance of SubstituteRelay.
Declaration
public SubstituteRelay(IRequestSpecification specification)
Parameters
Type | Name | Description |
---|---|---|
IRequestSpecification | specification | Specification to test whether request should be relayed. |
Properties
| Improve this Doc View SourceSpecification
Specification used to check whether a type request should be redirected to a substitute request.
Declaration
public IRequestSpecification Specification { get; }
Property Value
Type | Description |
---|---|
IRequestSpecification |
Methods
| Improve this Doc View SourceCreate(Object, ISpecimenContext)
Creates a substitute when request is an abstract type.
Declaration
public object Create(object request, ISpecimenContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Object | request | |
ISpecimenContext | context |
Returns
Type | Description |
---|---|
System.Object |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | An attempt to resolve a substitute from the |