Class MoqMockingProvider
Provider implementation that adapts Moq to the provider-neutral FastMoq abstractions.
Inheritance
MoqMockingProvider
Assembly: FastMoq.Provider.Moq.dll
Syntax
public sealed class MoqMockingProvider : IMockingProvider, IMockingProviderCapabilities
Fields
Instance
Gets the shared singleton instance of the Moq provider.
Declaration
public static readonly MoqMockingProvider 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 Moq supports base-call behavior.
Declaration
public bool SupportsCallBase { get; }
Property Value
SupportsInvocationTracking
Gets a value indicating whether Moq supports invocation tracking.
Declaration
public bool SupportsInvocationTracking { get; }
Property Value
SupportsLoggerCapture
Gets a value indicating whether Moq supports logger capture helpers.
Declaration
public bool SupportsLoggerCapture { get; }
Property Value
SupportsProtectedMembers
Gets a value indicating whether Moq supports protected member interception.
Declaration
public bool SupportsProtectedMembers { get; }
Property Value
SupportsSetupAllProperties
Gets a value indicating whether Moq supports automatic property backing.
Declaration
public bool SupportsSetupAllProperties { get; }
Property Value
Methods
BuildExpression<T>()
Builds a Moq expression scaffold for provider-specific use.
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 Moq mock.
Declaration
public IFastMock CreateMock(Type type, MockCreationOptions? options = null)
Parameters
Returns
CreateMock<T>(MockCreationOptions?)
Creates a typed FastMoq wrapper around a new Moq mock.
Declaration
public IFastMock<T> CreateMock<T>(MockCreationOptions? options = null) where T : class
Parameters
Returns
Type Parameters
SetCallBase(IFastMock, bool)
Enables or disables base-call behavior on the supplied mock.
Declaration
public void SetCallBase(IFastMock mock, bool value)
Parameters
SetupAllProperties(IFastMock)
Configures all settable properties on the supplied mock for automatic backing storage.
Declaration
public void SetupAllProperties(IFastMock mock)
Parameters
TryGetLegacy(IFastMock)
Attempts to expose the underlying Moq mock from a provider-neutral wrapper.
Declaration
public object? TryGetLegacy(IFastMock mock)
Parameters
Returns
TryWrapLegacy(object, Type)
Attempts to wrap an existing Moq mock in the provider-neutral 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 Moq 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 Moq 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