FastMoq
Search Results for

    Show / Hide Table of Contents

    Interface IMockingProvider

    Abstraction implemented by concrete mocking libraries (Moq, NSubstitute, etc.).

    Namespace: FastMoq.Providers
    Assembly: FastMoq.Abstractions.dll
    Syntax
    public interface IMockingProvider

    Properties

    Capabilities

    Gets the capabilities exposed by the current provider implementation.

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

    Methods

    BuildExpression<T>()

    Builds a provider-specific boolean expression scaffold for the mocked type.

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

    An expression that can be used by provider-specific setup or verification flows.

    Type Parameters
    Name Description
    T

    The mocked type.

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

    Configures logger behavior for the supplied mock.

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

    The logger mock to configure.

    Action<LogLevel, EventId, string, Exception> callback

    A callback that receives log details for each invocation.

    ConfigureProperties(IFastMock)

    Configures tracked properties for the supplied mock.

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

    The mock to configure.

    CreateMock(Type, MockCreationOptions?)

    Creates a mock wrapper for the specified runtime type.

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

    The mocked runtime type.

    MockCreationOptions options

    Optional creation settings for the mock.

    Returns
    Type Description
    IFastMock

    A provider-backed mock wrapper.

    CreateMock<T>(MockCreationOptions?)

    Creates a mock wrapper for the specified type.

    Declaration
    IFastMock<T> CreateMock<T>(MockCreationOptions? options = null) where T : class
    Parameters
    Type Name Description
    MockCreationOptions options

    Optional creation settings for the mock.

    Returns
    Type Description
    IFastMock<T>

    A provider-backed mock wrapper.

    Type Parameters
    Name Description
    T

    The mocked type.

    SetCallBase(IFastMock, bool)

    Enables or disables call-through behavior to the underlying implementation.

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

    The mock to configure.

    bool value

    True to call the base implementation; otherwise false.

    SetupAllProperties(IFastMock)

    Configures the mock so settable properties behave like auto-properties.

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

    The mock to configure.

    TryGetLegacy(IFastMock)

    Attempts to retrieve the provider's native legacy mock object for the supplied wrapper.

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

    The wrapped mock.

    Returns
    Type Description
    object

    The native legacy mock instance when available; otherwise null.

    TryWrapLegacy(object, Type)

    Attempts to wrap a provider-specific legacy mock instance in a FastMoq abstraction.

    Declaration
    IFastMock? TryWrapLegacy(object legacyMock, Type mockedType)
    Parameters
    Type Name Description
    object legacyMock

    The provider-specific mock instance.

    Type mockedType

    The mocked type represented by the legacy mock.

    Returns
    Type Description
    IFastMock

    A FastMoq wrapper when the object can be adapted; otherwise null.

    VerifyNoOtherCalls(IFastMock)

    Verifies that no unexpected invocations remain on the mock.

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

    The mock to verify.

    Verify<T>(IFastMock<T>, Expression<Action<T>>, TimesSpec?)

    Verifies that the specified call expression was invoked on the mock.

    Declaration
    void Verify<T>(IFastMock<T> mock, Expression<Action<T>> expression, TimesSpec? times = null) where T : class
    Parameters
    Type Name Description
    IFastMock<T> mock

    The mock to verify.

    Expression<Action<T>> expression

    The invocation expression to verify.

    TimesSpec? times

    The expected invocation count.

    Type Parameters
    Name Description
    T

    The mocked type.

    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 00:16 UTC