Interface IFluentConfig
Interface providing handy methods for setting up mock instance.
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
System.Reflection.Emit.CustomAttributeBuilder
attributeBuilder
An attribute builder object containing the attribute. |
Returns
IFluentConfig
The fluent configuration. |
CallConstructor(Object[])
Invokes the specified non-public constructor.
Declaration
IFluentConfig CallConstructor(object[] args)
Parameters
System.Object[]
args
Arguments to be passed to the constructor. |
Returns
IFluentConfig
The fluent configuration. |
MockConstructor()
Specifies to mock the constructor.
Declaration
IFluentConfig MockConstructor()
Returns
IFluentConfig
The fluent configuration. |
SetBehavior(Behavior)
Sets the behavior of the mock object.
Declaration
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
IFluentConfig SetInterceptorFilter(Expression<Predicate<MethodInfo>> filter)
Parameters
System.Linq.Expressions.Expression<System.Predicate<System.Reflection.MethodInfo>>
filter
|
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.