FastMoq
Search Results for

    Show / Hide Table of Contents

    Class IFastMockMoqExtensions

    Moq-specific convenience extensions for IFastMock and IFastMock<T>. These stay in the provider package so the core abstractions remain provider agnostic.

    Inheritance
    object
    IFastMockMoqExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: FastMoq.Providers.MoqProvider
    Assembly: FastMoq.Provider.Moq.dll
    Syntax
    public static class IFastMockMoqExtensions

    Methods

    AsMoq(IFastMock)

    Returns the provider-native non-generic Moq.Mock instance for a tracked FastMoq mock.

    Declaration
    public static Mock AsMoq(this IFastMock fastMock)
    Parameters
    Type Name Description
    IFastMock fastMock

    Tracked FastMoq mock.

    Returns
    Type Description
    Mock

    The underlying non-generic Moq.Mock.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when fastMock is null.

    NotSupportedException

    Thrown when the active provider is not Moq.

    AsMoq<T>(IFastMock<T>)

    Returns the provider-native Moq.Mock<T> instance for a tracked FastMoq mock.

    Declaration
    public static Mock<T> AsMoq<T>(this IFastMock<T> fastMock) where T : class
    Parameters
    Type Name Description
    IFastMock<T> fastMock

    Tracked FastMoq mock.

    Returns
    Type Description
    Mock<T>

    The underlying Moq.Mock<T>.

    Type Parameters
    Name Description
    T

    Mocked type.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when fastMock is null.

    NotSupportedException

    Thrown when the active provider is not Moq.

    Protected<T>(IFastMock<T>)

    Moq convenience shortcut for fastMock.AsMoq().Protected().

    Declaration
    public static IProtectedMock<T> Protected<T>(this IFastMock<T> fastMock) where T : class
    Parameters
    Type Name Description
    IFastMock<T> fastMock
    Returns
    Type Description
    IProtectedMock<T>
    Type Parameters
    Name Description
    T

    SetupGet<T, TProperty>(IFastMock<T>, Expression<Func<T, TProperty>>)

    Moq convenience shortcut for fastMock.AsMoq().SetupGet(...).

    Declaration
    public static ISetupGetter<T, TProperty> SetupGet<T, TProperty>(this IFastMock<T> fastMock, Expression<Func<T, TProperty>> expression) where T : class
    Parameters
    Type Name Description
    IFastMock<T> fastMock
    Expression<Func<T, TProperty>> expression
    Returns
    Type Description
    ISetupGetter<T, TProperty>
    Type Parameters
    Name Description
    T
    TProperty

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

    Moq logger compatibility shortcut for fastMock.AsMoq().SetupLoggerCallback(...).

    Declaration
    public static void SetupLoggerCallback(this IFastMock<ILogger> fastMock, Action<LogLevel, EventId, string, Exception?> callback)
    Parameters
    Type Name Description
    IFastMock<ILogger> fastMock
    Action<LogLevel, EventId, string, Exception> callback

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

    Moq logger compatibility shortcut for fastMock.AsMoq().SetupLoggerCallback(...).

    Declaration
    public static void SetupLoggerCallback<TLogger>(this IFastMock<TLogger> fastMock, Action<LogLevel, EventId, string, Exception?> callback) where TLogger : class, ILogger
    Parameters
    Type Name Description
    IFastMock<TLogger> fastMock
    Action<LogLevel, EventId, string, Exception> callback
    Type Parameters
    Name Description
    TLogger

    SetupSequence<T, TResult>(IFastMock<T>, Expression<Func<T, TResult>>)

    Moq convenience shortcut for fastMock.AsMoq().SetupSequence(...).

    Declaration
    public static ISetupSequentialResult<TResult> SetupSequence<T, TResult>(this IFastMock<T> fastMock, Expression<Func<T, TResult>> expression) where T : class
    Parameters
    Type Name Description
    IFastMock<T> fastMock
    Expression<Func<T, TResult>> expression
    Returns
    Type Description
    ISetupSequentialResult<TResult>
    Type Parameters
    Name Description
    T
    TResult

    Setup<T>(IFastMock<T>, Expression<Action<T>>)

    Moq convenience shortcut for fastMock.AsMoq().Setup(...).

    Declaration
    public static ISetup<T> Setup<T>(this IFastMock<T> fastMock, Expression<Action<T>> expression) where T : class
    Parameters
    Type Name Description
    IFastMock<T> fastMock
    Expression<Action<T>> expression
    Returns
    Type Description
    ISetup<T>
    Type Parameters
    Name Description
    T

    Setup<T, TResult>(IFastMock<T>, Expression<Func<T, TResult>>)

    Moq convenience shortcut for fastMock.AsMoq().Setup(...).

    Declaration
    public static ISetup<T, TResult> Setup<T, TResult>(this IFastMock<T> fastMock, Expression<Func<T, TResult>> expression) where T : class
    Parameters
    Type Name Description
    IFastMock<T> fastMock
    Expression<Func<T, TResult>> expression
    Returns
    Type Description
    ISetup<T, TResult>
    Type Parameters
    Name Description
    T
    TResult

    VerifyLogger(IFastMock<ILogger>, LogLevel, string, Exception?, int?, int)

    Moq logger compatibility shortcut for fastMock.AsMoq().VerifyLogger(...).

    Declaration
    public static void VerifyLogger(this IFastMock<ILogger> fastMock, LogLevel logLevel, string message, Exception? exception, int? eventId = null, int times = 1)
    Parameters
    Type Name Description
    IFastMock<ILogger> fastMock
    LogLevel logLevel
    string message
    Exception exception
    int? eventId
    int times

    VerifyLogger(IFastMock<ILogger>, LogLevel, string, int)

    Moq logger compatibility shortcut for fastMock.AsMoq().VerifyLogger(...).

    Declaration
    public static void VerifyLogger(this IFastMock<ILogger> fastMock, LogLevel logLevel, string message, int times = 1)
    Parameters
    Type Name Description
    IFastMock<ILogger> fastMock
    LogLevel logLevel
    string message
    int times

    VerifyLogger<TLogger>(IFastMock<TLogger>, LogLevel, string, Exception?, int?, int)

    Moq logger compatibility shortcut for fastMock.AsMoq().VerifyLogger(...).

    Declaration
    public static void VerifyLogger<TLogger>(this IFastMock<TLogger> fastMock, LogLevel logLevel, string message, Exception? exception, int? eventId = null, int times = 1) where TLogger : class, ILogger
    Parameters
    Type Name Description
    IFastMock<TLogger> fastMock
    LogLevel logLevel
    string message
    Exception exception
    int? eventId
    int times
    Type Parameters
    Name Description
    TLogger

    VerifyLogger<TLogger>(IFastMock<TLogger>, LogLevel, string, int)

    Moq logger compatibility shortcut for fastMock.AsMoq().VerifyLogger(...).

    Declaration
    public static void VerifyLogger<TLogger>(this IFastMock<TLogger> fastMock, LogLevel logLevel, string message, int times = 1) where TLogger : class, ILogger
    Parameters
    Type Name Description
    IFastMock<TLogger> fastMock
    LogLevel logLevel
    string message
    int times
    Type Parameters
    Name Description
    TLogger
    In this article
    Back to top
    Generated 2026-04-08 12:38 UTC