FastMoq
Search Results for

    Show / Hide Table of Contents

    Class MoqLoggerCompatibility

    Provides Moq-based logger verification and callback helpers used by the compatibility layer.

    Inheritance
    object
    MoqLoggerCompatibility
    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 MoqLoggerCompatibility

    Methods

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

    Registers a callback that receives normalized logger invocations from a Moq logger mock.

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

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

    Verifies a non-generic logger mock was written with the expected exception payload.

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

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

    Verifies a non-generic logger mock was written to the expected number of times.

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

    VerifyLogger<TException>(Mock<ILogger>, LogLevel, string, TException?, int?, Times)

    Verifies a non-generic logger mock using an exception type-specific matcher and a Moq Moq.Times constraint.

    Declaration
    public static void VerifyLogger<TException>(this Mock<ILogger> loggerMock, LogLevel logLevel, string message, TException? exception, int? eventId, Times times) where TException : Exception
    Parameters
    Type Name Description
    Mock<ILogger> loggerMock
    LogLevel logLevel
    string message
    TException exception
    int? eventId
    Times times
    Type Parameters
    Name Description
    TException

    VerifyLogger<TException>(Mock<ILogger>, LogLevel, string, TException?, int?, Func<Times>)

    Verifies a non-generic logger mock using an exception type-specific matcher and a deferred Moq Moq.Times constraint.

    Declaration
    public static void VerifyLogger<TException>(this Mock<ILogger> loggerMock, LogLevel logLevel, string message, TException? exception, int? eventId, Func<Times> times) where TException : Exception
    Parameters
    Type Name Description
    Mock<ILogger> loggerMock
    LogLevel logLevel
    string message
    TException exception
    int? eventId
    Func<Times> times
    Type Parameters
    Name Description
    TException

    VerifyLogger<TException>(Mock<ILogger>, LogLevel, string, TException?, int?, int)

    Verifies a non-generic logger mock using an exception type-specific matcher and an exact call count.

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

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

    Verifies a generic logger mock was written with the expected exception payload.

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

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

    Verifies a generic logger mock was written to the expected number of times.

    Declaration
    public static void VerifyLogger<TLogger>(this Mock<TLogger> loggerMock, LogLevel logLevel, string message, int times = 1) where TLogger : class, ILogger
    Parameters
    Type Name Description
    Mock<TLogger> loggerMock
    LogLevel logLevel
    string message
    int times
    Type Parameters
    Name Description
    TLogger

    VerifyLogger<TException, TLogger>(Mock<TLogger>, LogLevel, string, TException?, int?, int)

    Verifies a generic logger mock using an exception type-specific matcher and an exact call count.

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