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
MockWrapper<T>
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
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
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
Returns
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
Returns
Type Parameters
Verify(Expression<Action<T>>, TimesSpec?)
Executes provider verification for the supplied expression.
Declaration
public void Verify(Expression<Action<T>> expression, TimesSpec? times = null)
Parameters
Extension Methods