Table of Contents

Class HttpResponseValidator

Namespace
Xping.Sdk.Validations.HttpResponse
Assembly
Xping.Sdk.dll

Represents a validator for HTTP response. This class provides a mechanism to assert the validity of HTTP response based on user-defined criteria.

public class HttpResponseValidator : TestComponent, ITestComponent
Inheritance
HttpResponseValidator
Implements
Inherited Members

Constructors

HttpResponseValidator(Action<IHttpResponse>)

Initializes a new instance of the HttpResponseValidator class with a specified validation action.

public HttpResponseValidator(Action<IHttpResponse> validation)

Parameters

validation Action<IHttpResponse>

An Action delegate that encapsulates the validation logic for the HTTP response.

Exceptions

ArgumentNullException

Thrown when the validation action is null.

Fields

StepName

The name of the test component that uniquely identifies a HttpResponseValidator test operation.

public const string StepName = "HttpResponseValidator"

Field Value

string

Methods

HandleAsync(Uri, TestSettings, TestContext, IServiceProvider, CancellationToken)

This method performs the test step operation asynchronously.

public override Task HandleAsync(Uri url, TestSettings settings, TestContext context, IServiceProvider serviceProvider, CancellationToken cancellationToken = default)

Parameters

url Uri

A Uri object that represents the URL of the page being validated.

settings TestSettings

A TestSettings object that contains the settings for the test.

context TestContext

A TestContext object that represents the test context.

serviceProvider IServiceProvider

An instance object of a mechanism for retrieving a service object.

cancellationToken CancellationToken

An optional CancellationToken object that can be used to cancel this operation.

Returns

Task

Exceptions

ArgumentNullException

If any of the following parameters: url, settings or context is null.