Class MethodInvoker
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Creates a new instance of the requested type by invoking the first method it can satisfy.
public class MethodInvoker : ISpecimenBuilderInheritance
Implements
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Extension Methods
SpecimenFactory.Create<T>(ISpecimenBuilder), SpecimenFactory.CreateMany<T>(ISpecimenBuilder), SpecimenFactory.CreateMany<T>(ISpecimenBuilder, int), SpecimenCommand.Do<T>(ISpecimenBuilder, Action<T>), SpecimenCommand.Do<T1, T2>(ISpecimenBuilder, Action<T1, T2>), SpecimenCommand.Do<T1, T2, T3>(ISpecimenBuilder, Action<T1, T2, T3>), SpecimenCommand.Do<T1, T2, T3, T4>(ISpecimenBuilder, Action<T1, T2, T3, T4>), SpecimenQuery.Get<T, TResult>(ISpecimenBuilder, Func<T, TResult>), SpecimenQuery.Get<T1, T2, TResult>(ISpecimenBuilder, Func<T1, T2, TResult>), SpecimenQuery.Get<T1, T2, T3, TResult>(ISpecimenBuilder, Func<T1, T2, T3, TResult>), SpecimenQuery.Get<T1, T2, T3, T4, TResult>(ISpecimenBuilder, Func<T1, T2, T3, T4, TResult>), CustomizationExtensions.ToCustomization(ISpecimenBuilder)
Constructors
MethodInvoker(IMethodQuery)
Initializes a new instance of the MethodInvoker class with the supplied
IMethodQuery.
public MethodInvoker(IMethodQuery query)Parameters
query IMethodQuery
The IMethodQuery that defines which methods are attempted.
Properties
Query
Gets the IMethodQuery that defines which constructors will be
attempted.
public IMethodQuery Query { get; }Property Value
Methods
Create(object, ISpecimenContext)
Creates a specimen of the requested type by invoking the first constructor or method it can satisfy.
public object Create(object request, ISpecimenContext context)Parameters
request object
The request that describes what to create.
context ISpecimenContext
A context that can be used to create other specimens.
Returns
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.