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, Int32)
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(CancellationToken), [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] 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. |
Int32 | 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, Boolean, CancellationToken, String, String, Int32)
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(CancellationToken), [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITestOperationState<T> | state | Test operation state to start executing. |
TestInstructionExecutor | executor | Test test instruction executor to use. |
Boolean | 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. |
Int32 | 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.