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
validationAction<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
urlUriA Uri object that represents the URL of the page being validated.
settingsTestSettingsA TestSettings object that contains the settings for the test.
contextTestContextA TestContext object that represents the test context.
serviceProviderIServiceProviderAn instance object of a mechanism for retrieving a service object.
cancellationTokenCancellationTokenAn 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.