FastMoq
Search Results for

    Show / Hide Table of Contents

    Class MoqMockingProvider

    Provider implementation that adapts Moq to the provider-neutral FastMoq abstractions.

    Inheritance
    object
    MoqMockingProvider
    Implements
    IMockingProvider
    IMockingProviderCapabilities
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: FastMoq.Providers.MoqProvider
    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
    Type Description
    MoqMockingProvider

    Properties

    Capabilities

    Gets the capability descriptor for this provider.

    Declaration
    public IMockingProviderCapabilities Capabilities { get; }
    Property Value
    Type Description
    IMockingProviderCapabilities

    SupportsCallBase

    Gets a value indicating whether Moq supports base-call behavior.

    Declaration
    public bool SupportsCallBase { get; }
    Property Value
    Type Description
    bool

    SupportsInvocationTracking

    Gets a value indicating whether Moq supports invocation tracking.

    Declaration
    public bool SupportsInvocationTracking { get; }
    Property Value
    Type Description
    bool

    SupportsLoggerCapture

    Gets a value indicating whether Moq supports logger capture helpers.

    Declaration
    public bool SupportsLoggerCapture { get; }
    Property Value
    Type Description
    bool

    SupportsProtectedMembers

    Gets a value indicating whether Moq supports protected member interception.

    Declaration
    public bool SupportsProtectedMembers { get; }
    Property Value
    Type Description
    bool

    SupportsSetupAllProperties

    Gets a value indicating whether Moq supports automatic property backing.

    Declaration
    public bool SupportsSetupAllProperties { get; }
    Property Value
    Type Description
    bool

    Methods

    BuildExpression<T>()

    Builds a Moq expression scaffold for provider-specific use.

    Declaration
    public Expression<Func<T, bool>> BuildExpression<T>()
    Returns
    Type Description
    Expression<Func<T, bool>>
    Type Parameters
    Name Description
    T

    ConfigureLogger(IFastMock, Action<LogLevel, EventId, string, Exception?>)

    Configures logger callback capture on the supplied mock.

    Declaration
    public void ConfigureLogger(IFastMock mock, Action<LogLevel, EventId, string, Exception?> callback)
    Parameters
    Type Name Description
    IFastMock mock
    Action<LogLevel, EventId, string, Exception> callback

    ConfigureProperties(IFastMock)

    Configures property behavior on the supplied mock when the provider supports it.

    Declaration
    public void ConfigureProperties(IFastMock mock)
    Parameters
    Type Name Description
    IFastMock mock

    CreateMock(Type, MockCreationOptions?)

    Creates an untyped FastMoq wrapper around a new Moq mock.

    Declaration
    public IFastMock CreateMock(Type type, MockCreationOptions? options = null)
    Parameters
    Type Name Description
    Type type
    MockCreationOptions options
    Returns
    Type Description
    IFastMock

    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
    Type Name Description
    MockCreationOptions options
    Returns
    Type Description
    IFastMock<T>
    Type Parameters
    Name Description
    T

    SetCallBase(IFastMock, bool)

    Enables or disables base-call behavior on the supplied mock.

    Declaration
    public void SetCallBase(IFastMock mock, bool value)
    Parameters
    Type Name Description
    IFastMock mock
    bool value

    SetupAllProperties(IFastMock)

    Configures all settable properties on the supplied mock for automatic backing storage.

    Declaration
    public void SetupAllProperties(IFastMock mock)
    Parameters
    Type Name Description
    IFastMock mock

    TryGetLegacy(IFastMock)

    Attempts to expose the underlying Moq mock from a provider-neutral wrapper.

    Declaration
    public object? TryGetLegacy(IFastMock mock)
    Parameters
    Type Name Description
    IFastMock mock
    Returns
    Type Description
    object

    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
    Type Description
    IFastMock

    VerifyNoOtherCalls(IFastMock)

    Verifies that no unverified Moq calls remain on the supplied mock.

    Declaration
    public void VerifyNoOtherCalls(IFastMock mock)
    Parameters
    Type Name Description
    IFastMock mock

    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 Name Description
    IFastMock<T> mock
    Expression<Action<T>> expression
    TimesSpec? times
    Type Parameters
    Name Description
    T

    Implements

    IMockingProvider
    IMockingProviderCapabilities

    Extension Methods

    ObjectExtensions.RaiseIfNull<T>(T?, string?, string?, int?, string?)
    TestClassExtensions.GetFieldValue<TObject>(TObject, string, TObject?)
    TestClassExtensions.GetField<TObject>(TObject, string)
    TestClassExtensions.GetMemberName<T, TValue>(T, Expression<Func<T, TValue>>)
    TestClassExtensions.GetMember<T, TValue>(T, Expression<Func<T, TValue>>)
    TestClassExtensions.GetMethodValue<TObject>(TObject, string, object?, params object[])
    TestClassExtensions.GetMethod<TObject>(TObject, string)
    TestClassExtensions.GetPropertyValue<TObject>(TObject, string, object?)
    TestClassExtensions.GetProperty<TObject>(TObject, string)
    TestClassExtensions.SetFieldValue<TObject>(TObject, string, object?)
    TestClassExtensions.SetPropertyValue<TObject>(TObject, string, object?)
    MockerHttpMoqExtensions.SetupHttpMessage(object, Func<HttpResponseMessage>, Expression?, Expression?)
    MockerHttpMoqExtensions.SetupMessageAsync<TMock, TReturn>(object, Expression<Func<TMock, Task<TReturn>>>, Func<TReturn>)
    MockerHttpMoqExtensions.SetupMessageProtectedAsync<TMock, TReturn>(object, string, Func<TReturn>, params object?[]?)
    MockerHttpMoqExtensions.SetupMessageProtected<TMock, TReturn>(object, string, Func<TReturn>, params object?[]?)
    MockerHttpMoqExtensions.SetupMessage<TMock, TReturn>(object, Expression<Func<TMock, TReturn>>, Func<TReturn>)
    TestClassExtensions.GetFieldInfo<TType>(object, string)
    TestClassExtensions.GetFieldValue<T>(object?, FieldInfo)
    TestClassExtensions.GetFieldValue<T, TType>(object, string)
    In this article
    Back to top
    Generated 2026-04-08 12:38 UTC