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
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
UriA Uri object that represents the URL of the page being validated.
settings
TestSettingsA TestSettings object that contains the settings for the test.
context
TestContextA TestContext object that represents the test context.
serviceProvider
IServiceProviderAn instance object of a mechanism for retrieving a service object.
cancellationToken
CancellationTokenAn optional CancellationToken object that can be used to cancel this operation.
Returns
Exceptions
- ArgumentNullException
If any of the following parameters: url, settings or context is null.