Class TestOperationState
Contains extension methods on ITestOperationState<T>. These are normally not needed, but can be useful for debugging purposes.
Namespace: Responsible
Assembly: Responsible.dll
Syntax
public static class TestOperationState
Methods
ToTask<T>(ITestOperationState<T>, TestInstructionExecutor, CancellationToken, string, string, int)
Starts executing the explicitly created operation state. This can be used for e.g. logging the state periodically.
Declaration
public static Task<T> ToTask<T>(this ITestOperationState<T> state, TestInstructionExecutor executor, CancellationToken cancellationToken = default, string memberName = "", string sourceFilePath = "", int sourceLineNumber = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| ITestOperationState<T> | state | Test operation state to start executing. |
| TestInstructionExecutor | executor | Test test instruction executor to use. |
| CancellationToken | cancellationToken | Optional cancellation token to cancel the instruction prematurely. |
| string | memberName | Caller member name provided by compiler. May be overridden for custom operators. |
| string | sourceFilePath | Caller file path provided by compiler. May be overridden for custom operators. |
| int | sourceLineNumber | Source line number provided by compiler. May be overridden for custom operators. |
Returns
| Type | Description |
|---|---|
| Task<T> | An task which will complete with the value of the test operation, once it has completed, or an error if the operation fails. |
Type Parameters
| Name | Description |
|---|---|
| T | Result type of the test operation. |
Remarks
Be careful not to call this twice on the same state object: the consequences are undefined.
ToYieldInstruction<T>(ITestOperationState<T>, TestInstructionExecutor, bool, CancellationToken, string, string, int)
Unity-only!
Start executing an explicitly created operation state. This can be used for e.g. logging the state periodically.
Declaration
public static TestOperationYieldInstruction<T> ToYieldInstruction<T>(this ITestOperationState<T> state, TestInstructionExecutor executor, bool throwOnError = true, CancellationToken cancellationToken = default, string memberName = "", string sourceFilePath = "", int sourceLineNumber = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| ITestOperationState<T> | state | Test operation state to start executing. |
| TestInstructionExecutor | executor | Test test instruction executor to use. |
| bool | throwOnError | Whether or not to throw on cancellation or errors. |
| CancellationToken | cancellationToken | Optional cancellation token to cancel the instruction prematurely. |
| string | memberName | Caller member name provided by compiler. May be overridden for custom operators. |
| string | sourceFilePath | Caller file path provided by compiler. May be overridden for custom operators. |
| int | sourceLineNumber | Source line number provided by compiler. May be overridden for custom operators. |
Returns
| Type | Description |
|---|---|
| TestOperationYieldInstruction<T> | A yield instruction which will complete with the value of the test operation, once it has completed, or publish an error if the operation fails. |
Type Parameters
| Name | Description |
|---|---|
| T | Result type of the test operation. |
Remarks
Be careful not to call this twice on the same state object: the consequences are undefined.