Interface IStub<TService>
Configures stub return values for a service being mocked via Mock<TService>(Action<IStub<TService>>).
Arguments are ignored; unconfigured members return a safe default. There are no verifications or
assertions — this is only enough to let a component render statically.
Assembly: BlazorToolkit.Previews.dll
public interface IStub<TService> where TService : class
Type Parameters
| Name |
Description |
| TService |
The interface being stubbed.
|
Methods
Stubs a Task<TResult> member with a per-call factory (auto-wrapped).
Declaration
IStub<TService> SetupAsync<TResult>(Expression<Func<TService, Task<TResult>>> member, Func<TResult> factory)
Parameters
Returns
| Type |
Description |
| IStub<TService> |
|
Type Parameters
Stubs a Task<TResult> member; supply the unwrapped value (auto-wrapped).
Declaration
IStub<TService> SetupAsync<TResult>(Expression<Func<TService, Task<TResult>>> member, TResult value)
Parameters
Returns
| Type |
Description |
| IStub<TService> |
|
Type Parameters
Declaration
IStub<TService> SetupAsync<TResult>(Expression<Func<TService, ValueTask<TResult>>> member, Func<TResult> factory)
Parameters
Returns
| Type |
Description |
| IStub<TService> |
|
Type Parameters
Declaration
IStub<TService> SetupAsync<TResult>(Expression<Func<TService, ValueTask<TResult>>> member, TResult value)
Parameters
Returns
| Type |
Description |
| IStub<TService> |
|
Type Parameters
Stubs a synchronous method or property to return a value produced on each call.
Declaration
IStub<TService> Setup<TResult>(Expression<Func<TService, TResult>> member, Func<TResult> factory)
Parameters
Returns
| Type |
Description |
| IStub<TService> |
|
Type Parameters
Stubs a synchronous method or property to return a fixed value.
Declaration
IStub<TService> Setup<TResult>(Expression<Func<TService, TResult>> member, TResult value)
Parameters
| Type |
Name |
Description |
| Expression<Func<TService, TResult>> |
member |
|
| TResult |
value |
|
Returns
| Type |
Description |
| IStub<TService> |
|
Type Parameters