Performs an action as a new step within the current context and associates it
with the specified code reference. Verifies that the step produced the expected outcome.
Namespace:
Gallio.FrameworkAssembly: Gallio (in Gallio.dll) Version: 3.3.0.0 (3.3.610.0)
Syntax
| C# |
|---|
public static TestContext RunStepAndVerifyOutcome( string name, Action action, Nullable<TimeSpan> timeout, bool isTestCase, ICodeElementInfo codeElement, TestOutcome expectedOutcome ) |
| Visual Basic (Declaration) |
|---|
Public Shared Function RunStepAndVerifyOutcome ( _ name As String, _ action As Action, _ timeout As Nullable(Of TimeSpan), _ isTestCase As Boolean, _ codeElement As ICodeElementInfo, _ expectedOutcome As TestOutcome _ ) As TestContext |
Parameters
- name
- Type: System..::.String
The name of the step.
- action
- Type: Gallio.Common..::.Action
The action to perform.
- timeout
- Type: System..::.Nullable<(Of <(TimeSpan>)>)
The step execution timeout, or null if none.
- isTestCase
- Type: System..::.Boolean
True if the step represents an independent test case.
- codeElement
- Type: Gallio.Common.Reflection..::.ICodeElementInfo
The associated code element, or null if none.
- expectedOutcome
- Type: Gallio.Model..::.TestOutcome
The expected outcome of the step.
Return Value
The context of the step that ran.
Remarks
This method creates a new child context with a new nested TestStep, enters the child context, performs the action, then exits the child context.
This method may be called recursively to create nested steps or concurrently to create parallel steps.
This method verifies that the step produced the expected outcome. If a different outcome was obtained, then raises an assertion failure.
Exceptions
| Exception | Condition |
|---|---|
| System..::.ArgumentNullException | Thrown if name or action is null. |
| System..::.ArgumentException | Thrown if name is the empty string. |
| System..::.ArgumentOutOfRangeException | Thrown if timeout is negative. |
| Gallio.Framework.Assertions..::.AssertionFailureException | Thrown if the expected outcome was not obtained. |
| System..::.InvalidOperationException | Thrown if there is no current test context. |
