Class FakeItEasyBuilder
Namespace: AutoFixture.AutoFakeItEasy
Assembly: AutoFixture.AutoFakeItEasy.dll
Provides pre- and post-condition checks for requests for fake instances.
public class FakeItEasyBuilder : 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
FakeItEasyBuilder(ISpecimenBuilder)
Initializes a new instance of the FakeItEasyBuilder class with an
ISpecimenBuilder to decorate.
public FakeItEasyBuilder(ISpecimenBuilder builder)Parameters
builder ISpecimenBuilder
The builder which must build mock instances.
Remarks
builder is subsequently available through the `Builder`
property.
See Also
Properties
Builder
Gets the decorated builder supplied through the constructor.
public ISpecimenBuilder Builder { get; }Property Value
ISpecimenBuilder
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 mock instance created by FakeItEasy if appropriate; otherwise a
NoSpecimen instance.
Remarks
The Create method checks whether a request is for an interface or abstract class. If so it delegates the call to the decorated `Builder`. When the specimen is returned from the decorated `ISpecimenBuilder` the method checks whether the returned instance is a FakeItEasy Fake instance of the correct type.
If all pre- and post-conditions are satisfied, the mock instance is returned; otherwise a `NoSpecimen` instance.