New to Telerik JustMock? Start a free 30-day trial

IFluentConfig

Interface

Interface providing handy methods for setting up mock instance.

Definition

Namespace:Telerik.JustMock.Abstraction

Assembly:Telerik.JustMock.dll

Syntax:

C#
public interface IFluentConfig

Methods

Add an attribute to the created proxy type.

C#
IFluentConfig AddAttributeToProxy(CustomAttributeBuilder attributeBuilder)
Parameters:attributeBuilderCustomAttributeBuilder

An attribute builder object containing the attribute.

Returns:

IFluentConfig

The fluent configuration.

Invokes the specified non-public constructor.

C#
IFluentConfig CallConstructor(object[] args)
Parameters:argsobject[]

Arguments to be passed to the constructor.

Returns:

IFluentConfig

The fluent configuration.

Specifies to mock the constructor.

C#
IFluentConfig MockConstructor()
Returns:

IFluentConfig

The fluent configuration.

Sets the behavior of the mock object.

C#
IFluentConfig SetBehavior(Behavior behavior)
Parameters:behaviorBehavior

The mock behavior.

Returns:

IFluentConfig

The fluent configuration.

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

C#
IFluentConfig SetInterceptorFilter(Expression<Predicate<MethodInfo>> filter)
Parameters:filterExpression<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.