InterfaceIFluentConfig
Interface providing handy methods for setting up mock instance.
Definition
Namespace:Telerik.JustMock.Abstraction
Assembly:Telerik.JustMock.dll
Syntax:
public interface IFluentConfig
Methods
AddAttributeToProxy(CustomAttributeBuilder)
Add an attribute to the created proxy type.
Declaration
IFluentConfig AddAttributeToProxy(CustomAttributeBuilder attributeBuilder)
Parameters
attributeBuilder
An attribute builder object containing the attribute.
Returns
The fluent configuration.
CallConstructor(object[])
Invokes the specified non-public constructor.
Declaration
IFluentConfig CallConstructor(object[] args)
Parameters
args
object[]
Arguments to be passed to the constructor.
Returns
The fluent configuration.
MockConstructor()
Specifies to mock the constructor.
Declaration
IFluentConfig MockConstructor()
Returns
The fluent configuration.
SetBehavior(Behavior)
Sets the behavior of the mock object.
Declaration
IFluentConfig SetBehavior(Behavior behavior)
Parameters
behavior
The mock behavior.
Returns
The fluent configuration.
SetInterceptorFilter(Expression<Predicate<MethodInfo>>)
Sets a predicate that will filter whether a dynamic proxy method will be intercepted or not.
Declaration
IFluentConfig SetInterceptorFilter(Expression<Predicate<MethodInfo>> filter)
Parameters
filter
Returns
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.