C# Class Ploeh.AutoFixture.AutoFakeItEasy.FakeItEasyBuilder

Provides pre- and post-condition checks for requests for fake instances.
Inheritance: ISpecimenBuilder
Show file Open project: AutoFixture/AutoFixture

Public Methods

Method Description
Create ( object request, ISpecimenContext context ) : object

Creates a new specimen based on a request.

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.

FakeItEasyBuilder ( ISpecimenBuilder builder ) : System

Initializes a new instance of the FakeItEasyBuilder class with an ISpecimenBuilder to decorate.

builder is subsequently available through the Builder property.

Method Details

Create() public method

Creates a new specimen based on a request.

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.

public Create ( object request, ISpecimenContext context ) : object
request object The request that describes what to create.
context ISpecimenContext A context that can be used to create other specimens.
return object

FakeItEasyBuilder() public method

Initializes a new instance of the FakeItEasyBuilder class with an ISpecimenBuilder to decorate.

builder is subsequently available through the Builder property.

public FakeItEasyBuilder ( ISpecimenBuilder builder ) : System
builder ISpecimenBuilder The builder which must build mock instances.
return System