FastMoq
Search Results for

    Show / Hide Table of Contents

    Class MockWrapper<T>

    Provider-agnostic wrapper around an IFastMock<T> supplying:

    • Instance (test subject dependency)
    • NativeMock (legacy underlying mock if the provider exposes one)
    • Verify delegation through IMockingProvider
    • Transitional Setup helpers (Moq pass-through). Other providers throw until a common Setup abstraction exists.
    Inheritance
    object
    MockWrapper<T>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: FastMoq.Core.Providers
    Assembly: FastMoq.Core.dll
    Syntax
    public sealed class MockWrapper<T> where T : class
    Type Parameters
    Name Description
    T

    Mocked type.

    Properties

    Instance

    Strongly-typed mocked instance (injected dependency).

    Declaration
    public T Instance { get; }
    Property Value
    Type Description
    T

    NativeMock

    Underlying provider-specific object used for native mocking-library interaction. For Moq this is typically a Moq.Mock<T>; for providers like NSubstitute this is the substitute instance itself.

    Declaration
    public object? NativeMock { get; }
    Property Value
    Type Description
    object

    Methods

    Setup(Expression<Action<T>>)

    Moq transitional Setup (Action form). Returns the provider-native setup object when available; otherwise throws.

    Declaration
    [Obsolete("Setup(...) on MockWrapper<T> is a Moq compatibility surface for the v4 transition. Prefer provider-neutral helpers where available, or use NativeMock for provider-specific configuration.")]
    public object Setup(Expression<Action<T>> expression)
    Parameters
    Type Name Description
    Expression<Action<T>> expression
    Returns
    Type Description
    object

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

    Moq transitional Setup (Func<TResult> form). Returns the provider-native setup object when available; otherwise throws.

    Declaration
    [Obsolete("Setup(...) on MockWrapper<T> is a Moq compatibility surface for the v4 transition. Prefer provider-neutral helpers where available, or use NativeMock for provider-specific configuration.")]
    public object Setup<TResult>(Expression<Func<T, TResult>> expression)
    Parameters
    Type Name Description
    Expression<Func<T, TResult>> expression
    Returns
    Type Description
    object
    Type Parameters
    Name Description
    TResult

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

    Executes provider verification for the supplied expression.

    Declaration
    public void Verify(Expression<Action<T>> expression, TimesSpec? times = null)
    Parameters
    Type Name Description
    Expression<Action<T>> expression
    TimesSpec? times

    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?)
    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