Class MethodInvoker
Creates a new instance of the requested type by invoking the first method it can satisfy.
Inheritance
System.Object
MethodInvoker
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public class MethodInvoker : ISpecimenBuilder
Constructors
| Improve this Doc View SourceMethodInvoker(IMethodQuery)
Initializes a new instance of the MethodInvoker class with the supplied IMethodQuery.
Declaration
public MethodInvoker(IMethodQuery query)
Parameters
Type | Name | Description |
---|---|---|
IMethodQuery | query | The IMethodQuery that defines which methods are attempted. |
Properties
| Improve this Doc View SourceQuery
Gets the IMethodQuery that defines which constructors will be attempted.
Declaration
public IMethodQuery Query { get; }
Property Value
Type | Description |
---|---|
IMethodQuery |
Methods
| Improve this Doc View SourceCreate(Object, ISpecimenContext)
Creates a specimen of the requested type by invoking the first constructor or method it can satisfy.
Declaration
public object Create(object request, ISpecimenContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Object | request | The request that describes what to create. |
ISpecimenContext | context | A context that can be used to create other specimens. |
Returns
Type | Description |
---|---|
System.Object | A specimen generated from a method of the requested type, if possible; otherwise, null. |
Remarks
This method uses the first constructor or method returned by Query where
context
can create values for all parameters.