Class NSubstituteRegisterCallHandlerCommand
Namespace: AutoFixture.AutoNSubstitute
Assembly: AutoFixture.AutoNSubstitute.dll
Sets up a substitute object's methods so that the return values will be retrieved from a fixture, instead of being created directly by NSubstitute.
This will setup any void/non-void virtual methods (including property getters and generics).
public class NSubstituteRegisterCallHandlerCommand : ISpecimenCommandInheritance
object ← NSubstituteRegisterCallHandlerCommand
Implements
ISpecimenCommand
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
This will setup any void, non-void virtual methods. This includes:
- interface's methods/property getters;
- class's abstract/virtual/overridden/non-sealed methods/property getters;
Notes:
- Calling a method more than once with the same parameters will return the same value by default.
To override that behavior pass a custom
ICallResultCacheFactoryinstance. - Methods inherited from
Objectare not set up due to a limitation in NSubstitute (http://stackoverflow.com/a/21787891).
Constructors
NSubstituteRegisterCallHandlerCommand(ISubstitutionContext)
Creates a new NSubstituteRegisterCallHandlerCommand instance
with default ICallResultCacheFactory and ICallResultResolverFactory instances.
public NSubstituteRegisterCallHandlerCommand(ISubstitutionContext substitutionContext)Parameters
substitutionContext ISubstitutionContext
NSubstituteRegisterCallHandlerCommand(ISubstitutionContext, ICallResultCacheFactory, ICallResultResolverFactory)
Creates an new NSubstituteRegisterCallHandlerCommand instance.
public NSubstituteRegisterCallHandlerCommand(ISubstitutionContext substitutionContext, ICallResultCacheFactory callResultCacheFactory, ICallResultResolverFactory callResultResolverFactory)Parameters
substitutionContext ISubstitutionContext
callResultCacheFactory ICallResultCacheFactory
callResultResolverFactory ICallResultResolverFactory
Properties
CallResultCacheFactory
Factory used to create ICallResultCache instances.
public ICallResultCacheFactory CallResultCacheFactory { get; }Property Value
CallResultResolverFactory
Factory used to create ICallResultResolver instances.
public ICallResultResolverFactory CallResultResolverFactory { get; }Property Value
SubstitutionContext
The NSubstitute context.
public ISubstitutionContext SubstitutionContext { get; }Property Value
ISubstitutionContext
Methods
Execute(object, ISpecimenContext)
Registers a custom handler for the specified specimen if that is a substitute.
Custom handler resolves call result and ref/out arguments using the passed context.
public void Execute(object specimen, ISpecimenContext context)Parameters
specimen object
context ISpecimenContext