Edit

Share via


TestErrorInfo class

Namespace: Microsoft.Azure.Workflows.UnitTesting.ErrorResponses

This class provides extended and detailed error information for Standard logic app workflow testing scenarios, including error codes, messages, nested error details, and other contextual information.

Usage

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

Constructors

Primary constructor

Creates a new instance of the TestErrorInfo class.

public TestErrorInfo(ErrorResponseCode code, string message, TestErrorInfo[] details = null, TestErrorResponseAdditionalInfo[] additionalInfo = null)
Name Description Type Required
code The error code ErrorResponseCode Yes
message The error message string Yes
details The detailed error message details TestErrorInfo No
additionalInfo The array of additional information TestErrorResponseAdditionalInfo No
// Example: Creating an error with code and message
var error = new TestErrorInfo(
    ErrorResponseCode.NotFound,
    "The specified resource was not found"
);

Properties

Name Description Type Required
Code The error code ErrorResponseCode Yes
Message The error message string Yes
Details The detailed error message details TestErrorInfo No
AdditionalInfo The array of additional information TestErrorResponseAdditionalInfo No