Class NSubstituteMockingProvider
Provider implementation that adapts NSubstitute to the provider-neutral FastMoq abstractions.
Inheritance
NSubstituteMockingProvider
Assembly: FastMoq.Provider.NSubstitute.dll
Syntax
public sealed class NSubstituteMockingProvider : IMockingProvider, IMockingProviderCapabilities
Fields
Instance
Gets the shared singleton instance of the NSubstitute provider.
Declaration
public static readonly NSubstituteMockingProvider Instance
Field Value
Properties
Capabilities
Gets the capability descriptor for this provider.
Declaration
public IMockingProviderCapabilities Capabilities { get; }
Property Value
SupportsCallBase
Gets a value indicating whether NSubstitute supports base-call behavior.
Declaration
public bool SupportsCallBase { get; }
Property Value
SupportsInvocationTracking
Gets a value indicating whether NSubstitute supports invocation tracking.
Declaration
public bool SupportsInvocationTracking { get; }
Property Value
SupportsLoggerCapture
Gets a value indicating whether NSubstitute supports logger capture helpers.
Declaration
public bool SupportsLoggerCapture { get; }
Property Value
SupportsProtectedMembers
Gets a value indicating whether NSubstitute supports protected member interception.
Declaration
public bool SupportsProtectedMembers { get; }
Property Value
SupportsSetupAllProperties
Gets a value indicating whether NSubstitute supports automatic property backing.
Declaration
public bool SupportsSetupAllProperties { get; }
Property Value
Methods
BuildExpression<T>()
Builds a predicate expression suitable for provider-neutral matching.
Declaration
public Expression<Func<T, bool>> BuildExpression<T>()
Returns
Type Parameters
Configures logger callback capture on the supplied mock.
Declaration
public void ConfigureLogger(IFastMock mock, Action<LogLevel, EventId, string, Exception?> callback)
Parameters
Configures property behavior on the supplied mock when the provider supports it.
Declaration
public void ConfigureProperties(IFastMock mock)
Parameters
CreateMock(Type, MockCreationOptions?)
Creates an untyped FastMoq wrapper around a new NSubstitute substitute.
Declaration
public IFastMock CreateMock(Type type, MockCreationOptions? options = null)
Parameters
Returns
CreateMock<T>(MockCreationOptions?)
Creates a typed FastMoq wrapper around a new NSubstitute substitute.
Declaration
public IFastMock<T> CreateMock<T>(MockCreationOptions? options = null) where T : class
Parameters
Returns
Type Parameters
SetCallBase(IFastMock, bool)
Requests base-call behavior on the supplied mock.
Declaration
public void SetCallBase(IFastMock mock, bool value)
Parameters
SetupAllProperties(IFastMock)
Requests property auto-configuration on the supplied mock.
Declaration
public void SetupAllProperties(IFastMock mock)
Parameters
TryGetLegacy(IFastMock)
Attempts to expose a provider-specific legacy mock object from a wrapper.
Declaration
public object? TryGetLegacy(IFastMock mock)
Parameters
Returns
TryWrapLegacy(object, Type)
Attempts to wrap a provider-specific legacy mock object in the FastMoq abstraction.
Declaration
public IFastMock? TryWrapLegacy(object legacyMock, Type mockedType)
Parameters
| Type |
Name |
Description |
| object |
legacyMock |
|
| Type |
mockedType |
|
Returns
VerifyNoOtherCalls(IFastMock)
Verifies that no unverified calls remain on the supplied mock.
Declaration
public void VerifyNoOtherCalls(IFastMock mock)
Parameters
Verify<T>(IFastMock<T>, Expression<Action<T>>, TimesSpec?)
Verifies that the supplied expression was invoked on the wrapped NSubstitute mock.
Declaration
public void Verify<T>(IFastMock<T> mock, Expression<Action<T>> expression, TimesSpec? times = null) where T : class
Parameters
Type Parameters
Implements
Extension Methods