Interface
IFluentConfig

Interface providing handy methods for setting up mock instance.

Definition

Namespace:Telerik.JustMock.Abstraction

Assembly:Telerik.JustMock.dll

Syntax:

cs-api-definition
public interface IFluentConfig

Methods

AddAttributeToProxy(CustomAttributeBuilder)

Add an attribute to the created proxy type.

Declaration

cs-api-definition
IFluentConfig AddAttributeToProxy(CustomAttributeBuilder attributeBuilder)

Parameters

attributeBuilder

CustomAttributeBuilder

An attribute builder object containing the attribute.

Returns

IFluentConfig

The fluent configuration.

CallConstructor(object[])

Invokes the specified non-public constructor.

Declaration

cs-api-definition
IFluentConfig CallConstructor(object[] args)

Parameters

args

object[]

Arguments to be passed to the constructor.

Returns

IFluentConfig

The fluent configuration.

MockConstructor()

Specifies to mock the constructor.

Declaration

cs-api-definition
IFluentConfig MockConstructor()

Returns

IFluentConfig

The fluent configuration.

SetBehavior(Behavior)

Sets the behavior of the mock object.

Declaration

cs-api-definition
IFluentConfig SetBehavior(Behavior behavior)

Parameters

behavior

Behavior

The mock behavior.

Returns

IFluentConfig

The fluent configuration.

SetInterceptorFilter(Expression<Predicate<MethodInfo>>)

Sets a predicate that will filter whether a dynamic proxy method will be intercepted or not.

Declaration

cs-api-definition
IFluentConfig SetInterceptorFilter(Expression<Predicate<MethodInfo>> filter)

Parameters

filter

Expression<Predicate<MethodInfo>>

Returns

IFluentConfig

The fluent configuration.

Remarks

Dynamic proxy methods are the methods that proxy calls from interface methods, abstract methods or inherited virtual methods. If a filter is not specified, then, by default, all methods are intercepted. If a method is not intercepted, it cannot be mocked.

The interceptor filter allows you to specify which methods will be intercepted and which won't be. Normally, you'd want to intercept all methods. However, there are practical limitations to the number of members that can be intercepted on a given type. If a type has more than about 5000 interceptable members, then the time needed to generate the proxy type may be impractically long. In those cases specify a filter that will remove from interception those members that you don't intend to mock anyway.