FastMoq
Search Results for

    Show / Hide Table of Contents

    Class DbContextMockerExtensions

    Entity Framework-specific FastMoq helpers.

    Inheritance
    object
    DbContextMockerExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: FastMoq
    Assembly: FastMoq.Database.dll
    Syntax
    public static class DbContextMockerExtensions

    Methods

    CreateLegacyDbContextMock(Type, MockBehavior, object?[])

    Declaration
    public static Mock? CreateLegacyDbContextMock(Type requestedType, MockBehavior behavior, object?[] constructorArgs)
    Parameters
    Type Name Description
    Type requestedType
    MockBehavior behavior
    object[] constructorArgs
    Returns
    Type Description
    Mock

    GetDbContextHandle<TContext>(Mocker, DbContextHandleOptions<TContext>?)

    Creates or returns a DbContext test handle using the requested provisioning mode.

    Declaration
    public static DbContextHandle<TContext> GetDbContextHandle<TContext>(this Mocker mocker, DbContextHandleOptions<TContext>? options = null) where TContext : DbContext
    Parameters
    Type Name Description
    Mocker mocker
    DbContextHandleOptions<TContext> options
    Returns
    Type Description
    DbContextHandle<TContext>
    Type Parameters
    Name Description
    TContext

    GetMockDbContext(Mocker, Type)

    Creates or returns the tracked DbContext mock for the requested context type.

    Declaration
    public static Mock GetMockDbContext(this Mocker mocker, Type dbContextType)
    Parameters
    Type Name Description
    Mocker mocker
    Type dbContextType
    Returns
    Type Description
    Mock

    GetMockDbContext<TContext>(Mocker)

    Creates or returns the tracked DbContext mock for the requested context type.

    Declaration
    public static DbContextMock<TContext> GetMockDbContext<TContext>(this Mocker mocker) where TContext : DbContext
    Parameters
    Type Name Description
    Mocker mocker
    Returns
    Type Description
    DbContextMock<TContext>
    Type Parameters
    Name Description
    TContext

    TryCreateManagedDbContextInstance(Mocker, Type, out object?)

    Declaration
    public static bool TryCreateManagedDbContextInstance(Mocker mocker, Type requestedType, out object? instance)
    Parameters
    Type Name Description
    Mocker mocker
    Type requestedType
    object instance
    Returns
    Type Description
    bool
    In this article
    Back to top
    Generated 2026-04-08 00:16 UTC