Class NSubstituteVirtualMethodsCommand
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 non-void virtual methods.
Inheritance
System.Object
NSubstituteVirtualMethodsCommand
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.AutoNSubstitute
Assembly: AutoFixture.AutoNSubstitute.dll
Syntax
[Obsolete("This class belongs to the legacy integration approach. Use the NSubstituteRegisterCallHandlerCommand class and its dependencies instead.")]
public class NSubstituteVirtualMethodsCommand : ISpecimenCommand
Remarks
This will setup any non-void virtual methods. This includes:
- interface's methods/property getters;
- class's abstract/virtual/overridden/non-sealed methods/property getters.
Notes:
- Automatic mocking of generic methods isn't feasible - we'd have to antecipate any type parameters that this method could be called with.
- Void methods are not set up due to a limitation in NSubstitute that When..Do setups can't be overriden
- Calling a method more than once with the same parameters will always return the same value
- Methods inherited from System.Object are not set up due to a limitation in NSubstitute (http://stackoverflow.com/a/21787891).
Methods
| Improve this Doc View SourceExecute(Object, ISpecimenContext)
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.
Declaration
public void Execute(object specimen, ISpecimenContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Object | specimen | The substitute to setup. |
ISpecimenContext | context | The context of the specimen. |