Class RhinoMockAroundAdvice

Namespace: AutoFixture.AutoRhinoMock
Assembly: AutoFixture.AutoRhinoMock.dll

Provides pre- and post-condition checks for requests for mock instances.

public class RhinoMockAroundAdvice : ISpecimenBuilder

Inheritance

objectRhinoMockAroundAdvice

Implements

ISpecimenBuilder

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

RhinoMockAroundAdvice(ISpecimenBuilder)

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

public RhinoMockAroundAdvice(ISpecimenBuilder builder)

Parameters

builder ISpecimenBuilder

The builder which must build mock instances.

Remarks

builder is subsequently available through the `Builder` property.

See Also

RhinoMockAroundAdvice.Builder

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

object

A mock instance created by Rhino Mocks 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, indeed, a Rhino Mocks instance.

If all pre- and post-conditions are satisfied, the mock instance is returned; otherwise a `NoSpecimen` instance.

See Also