Table of Contents

Interface ITestHost

Namespace
Mokkit.Suite
Assembly
Mokkit.dll

Represents a test host that provides dependency injection and service execution capabilities for test scenarios. This interface extends System.IDisposable to ensure proper cleanup of resources after test execution. The test host resolves services from configured dependency containers and executes actions with those services.

public interface ITestHost : IDisposable

Implements

Methods

Execute<TService>(Action<TService>)

Executes an action with a single resolved service of type TService.

void Execute<TService>(Action<TService> actionFn) where TService : class

Parameters

actionFn Action<TService>

The action to execute with the resolved service.

Type Parameters

TService

The type of service to resolve and pass to the action.

Execute<TService, TService2>(Action<TService, TService2>)

Executes an action with two resolved services of types TService and TService2.

void Execute<TService, TService2>(Action<TService, TService2> actionFn) where TService : class where TService2 : class

Parameters

actionFn Action<TService, TService2>

The action to execute with the resolved services.

Type Parameters

TService

The type of the first service to resolve.

TService2

The type of the second service to resolve.

Execute<TService, TService2, TService3>(Action<TService, TService2, TService3>)

Executes an action with three resolved services of types TService, TService2, and TService3.

void Execute<TService, TService2, TService3>(Action<TService, TService2, TService3> actionFn) where TService : class where TService2 : class where TService3 : class

Parameters

actionFn Action<TService, TService2, TService3>

The action to execute with the resolved services.

Type Parameters

TService

The type of the first service to resolve.

TService2

The type of the second service to resolve.

TService3

The type of the third service to resolve.

Execute<TService, TService2, TService3, TService4>(Action<TService, TService2, TService3, TService4>)

Executes an action with four resolved services of types TService, TService2, TService3, and TService4.

void Execute<TService, TService2, TService3, TService4>(Action<TService, TService2, TService3, TService4> actionFn) where TService : class where TService2 : class where TService3 : class where TService4 : class

Parameters

actionFn Action<TService, TService2, TService3, TService4>

The action to execute with the resolved services.

Type Parameters

TService

The type of the first service to resolve.

TService2

The type of the second service to resolve.

TService3

The type of the third service to resolve.

TService4

The type of the fourth service to resolve.

Execute<TService, TOutput>(Func<TService, TOutput>)

Executes a function with a single resolved service of type TService and returns the result.

TOutput Execute<TService, TOutput>(Func<TService, TOutput> actionFn) where TService : class

Parameters

actionFn Func<TService, TOutput>

The function to execute with the resolved service.

Returns

TOutput

The result of the function execution.

Type Parameters

TService

The type of service to resolve and pass to the function.

TOutput

The type of the result returned by the function.

Execute<TService, TService2, TOutput>(Func<TService, TService2, TOutput>)

Executes a function with two resolved services of types TService and TService2 and returns the result.

TOutput Execute<TService, TService2, TOutput>(Func<TService, TService2, TOutput> actionFn) where TService : class where TService2 : class

Parameters

actionFn Func<TService, TService2, TOutput>

The function to execute with the resolved services.

Returns

TOutput

The result of the function execution.

Type Parameters

TService

The type of the first service to resolve.

TService2

The type of the second service to resolve.

TOutput

The type of the result returned by the function.

Execute<TService, TService2, TService3, TOutput>(Func<TService, TService2, TService3, TOutput>)

Executes a function with three resolved services of types TService, TService2, and TService3 and returns the result.

TOutput Execute<TService, TService2, TService3, TOutput>(Func<TService, TService2, TService3, TOutput> actionFn) where TService : class where TService2 : class where TService3 : class

Parameters

actionFn Func<TService, TService2, TService3, TOutput>

The function to execute with the resolved services.

Returns

TOutput

The result of the function execution.

Type Parameters

TService

The type of the first service to resolve.

TService2

The type of the second service to resolve.

TService3

The type of the third service to resolve.

TOutput

The type of the result returned by the function.

Execute<TService, TService2, TService3, TService4, TOutput>(Func<TService, TService2, TService3, TService4, TOutput>)

Executes a function with four resolved services of types TService, TService2, TService3, and TService4 and returns the result.

TOutput Execute<TService, TService2, TService3, TService4, TOutput>(Func<TService, TService2, TService3, TService4, TOutput> actionFn) where TService : class where TService2 : class where TService3 : class where TService4 : class

Parameters

actionFn Func<TService, TService2, TService3, TService4, TOutput>

The function to execute with the resolved services.

Returns

TOutput

The result of the function execution.

Type Parameters

TService

The type of the first service to resolve.

TService2

The type of the second service to resolve.

TService3

The type of the third service to resolve.

TService4

The type of the fourth service to resolve.

TOutput

The type of the result returned by the function.

ExecuteAsync<TService>(Func<TService, Task>)

Executes an action with a single resolved service of type TService asynchronously.

Task ExecuteAsync<TService>(Func<TService, Task> actionFn) where TService : class

Parameters

actionFn Func<TService, Task>

The action to execute with the resolved service.

Returns

Task

Type Parameters

TService

The type of service to resolve and pass to the action.

ExecuteAsync<TService, TService2>(Func<TService, TService2, Task>)

Executes an action with two resolved services of types TService and TService2 asynchronously.

Task ExecuteAsync<TService, TService2>(Func<TService, TService2, Task> actionFn) where TService : class where TService2 : class

Parameters

actionFn Func<TService, TService2, Task>

The action to execute with the resolved services.

Returns

Task

Type Parameters

TService

The type of the first service to resolve.

TService2

The type of the second service to resolve.

ExecuteAsync<TService, TService2, TService3>(Func<TService, TService2, TService3, Task>)

Executes an action with three resolved services of types TService, TService2, and TService3 asynchronously.

Task ExecuteAsync<TService, TService2, TService3>(Func<TService, TService2, TService3, Task> actionFn) where TService : class where TService2 : class where TService3 : class

Parameters

actionFn Func<TService, TService2, TService3, Task>

The action to execute with the resolved services.

Returns

Task

Type Parameters

TService

The type of the first service to resolve.

TService2

The type of the second service to resolve.

TService3

The type of the third service to resolve.

ExecuteAsync<TService, TService2, TService3, TService4>(Func<TService, TService2, TService3, TService4, Task>)

Executes an action with four resolved services of types TService, TService2, TService3, and TService4 asynchronously.

Task ExecuteAsync<TService, TService2, TService3, TService4>(Func<TService, TService2, TService3, TService4, Task> actionFn) where TService : class where TService2 : class where TService3 : class where TService4 : class

Parameters

actionFn Func<TService, TService2, TService3, TService4, Task>

The action to execute with the resolved services.

Returns

Task

Type Parameters

TService

The type of the first service to resolve.

TService2

The type of the second service to resolve.

TService3

The type of the third service to resolve.

TService4

The type of the fourth service to resolve.

ExecuteAsync<TService, TOutput>(Func<TService, Task<TOutput>>)

Executes a function with a single resolved service of type TService and returns the result asynchronously.

Task<TOutput> ExecuteAsync<TService, TOutput>(Func<TService, Task<TOutput>> actionFn) where TService : class

Parameters

actionFn Func<TService, Task<TOutput>>

The function to execute with the resolved service.

Returns

Task<TOutput>

The result of the function execution.

Type Parameters

TService

The type of service to resolve and pass to the function.

TOutput

The type of the result returned by the function.

ExecuteAsync<TService, TService2, TOutput>(Func<TService, TService2, Task<TOutput>>)

Executes a function with two resolved services of types TService and TService2 and returns the result asynchronously.

Task<TOutput> ExecuteAsync<TService, TService2, TOutput>(Func<TService, TService2, Task<TOutput>> actionFn) where TService : class where TService2 : class

Parameters

actionFn Func<TService, TService2, Task<TOutput>>

The function to execute with the resolved services.

Returns

Task<TOutput>

The result of the function execution.

Type Parameters

TService

The type of the first service to resolve.

TService2

The type of the second service to resolve.

TOutput

The type of the result returned by the function.

ExecuteAsync<TService, TService2, TService3, TOutput>(Func<TService, TService2, TService3, Task<TOutput>>)

Executes a function with three resolved services of types TService, TService2, and TService3 and returns the result asynchronously.

Task<TOutput> ExecuteAsync<TService, TService2, TService3, TOutput>(Func<TService, TService2, TService3, Task<TOutput>> actionFn) where TService : class where TService2 : class where TService3 : class

Parameters

actionFn Func<TService, TService2, TService3, Task<TOutput>>

The function to execute with the resolved services.

Returns

Task<TOutput>

The result of the function execution.

Type Parameters

TService

The type of the first service to resolve.

TService2

The type of the second service to resolve.

TService3

The type of the third service to resolve.

TOutput

The type of the result returned by the function.

ExecuteAsync<TService, TService2, TService3, TService4, TOutput>(Func<TService, TService2, TService3, TService4, Task<TOutput>>)

Executes a function with four resolved services of types TService, TService2, TService3, and TService4 and returns the result asynchronously.

Task<TOutput> ExecuteAsync<TService, TService2, TService3, TService4, TOutput>(Func<TService, TService2, TService3, TService4, Task<TOutput>> actionFn) where TService : class where TService2 : class where TService3 : class where TService4 : class

Parameters

actionFn Func<TService, TService2, TService3, TService4, Task<TOutput>>

The function to execute with the resolved services.

Returns

Task<TOutput>

The result of the function execution.

Type Parameters

TService

The type of the first service to resolve.

TService2

The type of the second service to resolve.

TService3

The type of the third service to resolve.

TService4

The type of the fourth service to resolve.

TOutput

The type of the result returned by the function.