Edit

Share via


TestExecutionContext class

Namespace: Microsoft.Azure.Workflows.UnitTesting.Definitions

This class provides the execution context for a unit test used for Standard workflow testing in single-tenant Azure Logic Apps. The class helps maintain the state during test execution and is useful when you want to create dynamic mocks that respond differently based on the current workflow state.

Usage

var actionMock = new CallExternalSystemsActionMock(name: "Call_External_Systems", onGetActionMock: (testExecutionContext) =>
{
    return new CallExternalSystemsActionMock(
        status: TestWorkflowStatus.Succeeded,
        outputs: new CallExternalSystemsActionOutput {
            Body = new JObject
            {
                { "name", testExecutionContext.ActionContext.ActionName },
                { "inputs", testExecutionContext.ActionContext.ActionInputs },
                { "scope", testExecutionContext.ActionContext.ParentActionName },
                { "iteration", testExecutionContext.ActionContext.CurrentIterationInput.Index }
            }
        }
    );
});

Properties

Name Description Type Required
ActionContext Gets the current action context. TestActionExecutionContext Yes