你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
命名空间:Microsoft.Azure.Workflows.UnitTesting.ErrorResponses
此类为标准逻辑应用工作流测试方案提供扩展和详细的错误信息,包括错误代码、消息、嵌套错误详细信息和其他上下文信息。
用法
// Simple error
var basicError = new TestErrorInfo(
ErrorResponseCode.BadRequest,
"Invalid input parameter"
);
// Nested errors with additional info
var detailError1 = new TestErrorInfo(
ErrorResponseCode.ValidationError,
"Field 'email' is required"
);
var detailError2 = new TestErrorInfo(
ErrorResponseCode.ValidationError,
"Field 'age' must be a positive number"
);
var additionalInfo = new TestErrorResponseAdditionalInfo[]
{
new TestErrorResponseAdditionalInfo
{
Type = "RequestId",
Info = JToken.FromObject("req-12345")
}
};
var complexError = new TestErrorInfo(
ErrorResponseCode.BadRequest,
"Request validation failed",
new[] { detailError1, detailError2 },
additionalInfo
);
构造函数
主构造函数
创建 TestErrorInfo
类的新实例。
public TestErrorInfo(ErrorResponseCode code, string message, TestErrorInfo[] details = null, TestErrorResponseAdditionalInfo[] additionalInfo = null)
名称 | DESCRIPTION | 类型 | 必选 |
---|---|---|---|
代码 | 错误代码 | 错误响应代码 | 是的 |
消息 | 错误消息 | 字符串 | 是的 |
详 | 详细的错误消息详细信息 | TestErrorInfo | 否 |
additionalInfo | 其他信息的数组 | TestErrorResponseAdditionalInfo | 否 |
// Example: Creating an error with code and message
var error = new TestErrorInfo(
ErrorResponseCode.NotFound,
"The specified resource was not found"
);
性能
名称 | DESCRIPTION | 类型 | 必选 |
---|---|---|---|
代码 | 错误代码 | 错误响应代码 | 是的 |
消息 | 错误消息 | 字符串 | 是的 |
详细信息 | 详细的错误消息详细信息 | TestErrorInfo | 否 |
附加信息 | 其他信息的数组 | TestErrorResponseAdditionalInfo | 否 |
相关内容
- ActionMock 类定义
- TriggerMock 类定义
- TestActionExecutionContext 类定义
- TestExecutionContext 类定义
- TestIterationItem 类定义
- TestWorkflowRun 类定义
- TestErrorResponseAdditionalInfo 类定义
- TestWorkflowOutputParameter 类定义
- TestWorkflowRunActionRepetitionResult 类定义
- TestWorkflowRunActionResult 类定义
- TestWorkflowRunTriggerResult 类定义
- TestWorkflowStatus 枚举定义
- UnitTestExecutor 类定义