Class FakeItEasyRelay
Namespace: AutoFixture.AutoFakeItEasy
Assembly: AutoFixture.AutoFakeItEasy.dll
Relays a request for an interface or an abstract class to a request for a
Fake%601 of that class.
public class FakeItEasyRelay : ISpecimenBuilderInheritance
Implements
ISpecimenBuilder
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
FakeItEasyRelay()
Initializes a new instance of the FakeItEasyRelay class.
public FakeItEasyRelay()FakeItEasyRelay(IRequestSpecification)
Initializes a new instance of the FakeItEasyRelay class with a specification
that determines whether a type should be mocked.
public FakeItEasyRelay(IRequestSpecification fakeableSpecification)Parameters
fakeableSpecification IRequestSpecification
A specification that determines whether a type should be mocked or not.
Properties
FakeableSpecification
Gets a specification that determines whether a given type should be mocked.
public IRequestSpecification FakeableSpecification { get; }Property Value
IRequestSpecification
Remarks
This specification determins whether a given type should be relayed as a request for a mock of the same type. By default it only returns true for interfaces and abstract classes, but a different specification can be supplied by using the overloaded constructor that takes an `IRequestSpecification` as input. In that case, this property returns the specification supplied to the constructor.
See Also
Methods
Create(object, ISpecimenContext)
Creates a new specimen based on a request.
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
A dynamic mock instance of the requested interface or abstract class if possible;
otherwise a NoSpecimen instance.