Interface IRecursionHandler
Handles a recursive request.
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public interface IRecursionHandler
Remarks
When AutoFixture is asked to create instances of complex custom types, it uses Reflection to figure out which constructor arguments and property values to assign. If the custom types contains circular references, this will cause an infinite recursion. To prevent that, RecursionGuard monitors requests in order to detect this type of situation. If RecursionGuard detects this situation, it calls HandleRecursiveRequest(Object, IEnumerable<Object>) on a composed IRecursionHandler.
Methods
| Improve this Doc View SourceHandleRecursiveRequest(Object, IEnumerable<Object>)
Handles a recursive request.
Declaration
object HandleRecursiveRequest(object request, IEnumerable<object> recordedRequests)
Parameters
Type | Name | Description |
---|---|---|
System.Object | request | The request causing the recursion. |
System.Collections.Generic.IEnumerable<System.Object> | recordedRequests | Previously recorded, and yet unhandled, requests. |
Returns
Type | Description |
---|---|
System.Object | An object intended to break the recursion. |
Remarks
This method is called when AutoFixture detects an infinite
recursion. The request
is the request that
triggered the recursion detection;
recordedRequests
contains all previous, but
still unhandled requests: the current call stack, if you will.