你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

TestExecutionContext 类

命名空间:Microsoft.Azure.Workflows.UnitTesting.Definitions

此类为单租户 Azure 逻辑应用中用于标准工作流测试的单元测试提供执行上下文。 类有助于在测试执行期间维护状态,当你想要创建基于当前工作流状态以不同方式做出不同响应的动态模拟时,该模型非常有用。

用法

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 }
            }
        }
    );
});

性能

名称 DESCRIPTION 类型 必选
ActionContext 获取当前作上下文。 TestActionExecutionContext 是的