FastMoq
Search Results for

    Show / Hide Table of Contents

    Class FunctionContextTestExtensions

    Provides Azure Functions worker helpers for typed InstanceServices setup.

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

    Methods

    AddFunctionContextInstanceServices(Mocker, Action<IServiceCollection>?, bool, bool)

    Builds and registers typed InstanceServices behavior for the current Mocker instance.

    Declaration
    public static Mocker AddFunctionContextInstanceServices(this Mocker mocker, Action<IServiceCollection>? configureServices = null, bool replace = false, bool includeWorkerDefaults = true)
    Parameters
    Type Name Description
    Mocker mocker

    The current Mocker instance.

    Action<IServiceCollection> configureServices

    Optional service registrations to apply after the worker defaults.

    bool replace

    True to replace an existing known-type registration.

    bool includeWorkerDefaults

    True to include logging, options, and WorkerOptions setup.

    Returns
    Type Description
    Mocker

    The current Mocker instance.

    AddFunctionContextInstanceServices(Mocker, IServiceProvider, bool)

    Registers typed InstanceServices behavior for the current Mocker instance.

    Declaration
    public static Mocker AddFunctionContextInstanceServices(this Mocker mocker, IServiceProvider instanceServices, bool replace = false)
    Parameters
    Type Name Description
    Mocker mocker

    The current Mocker instance.

    IServiceProvider instanceServices

    The provider to expose through InstanceServices.

    bool replace

    True to replace an existing known-type registration.

    Returns
    Type Description
    Mocker

    The current Mocker instance.

    CreateFunctionContextInstanceServices(Mocker, Action<IServiceCollection>?, bool)

    Creates a typed InstanceServices provider with the common Azure Functions worker defaults.

    Declaration
    public static IServiceProvider CreateFunctionContextInstanceServices(this Mocker mocker, Action<IServiceCollection>? configureServices = null, bool includeWorkerDefaults = true)
    Parameters
    Type Name Description
    Mocker mocker

    The current Mocker instance.

    Action<IServiceCollection> configureServices

    Optional service registrations to apply after the worker defaults.

    bool includeWorkerDefaults

    True to include logging, options, and WorkerOptions setup.

    Returns
    Type Description
    IServiceProvider

    A typed IServiceProvider suitable for InstanceServices.

    In this article
    Back to top
    Generated 2026-04-12 00:48 UTC