Class HttpClientRequestSender
The HttpClientRequestSender class is a concrete implementation of the TestComponent class that is used to send an HTTP request. It uses the IHttpClientFactory to create an instance of the HttpClient class, which is used to send the HTTP request.
public sealed class HttpClientRequestSender : TestComponent, ITestComponent
- Inheritance
-
HttpClientRequestSender
- Implements
- Inherited Members
Remarks
Before using this test component, you need to register the necessary services by calling the AddHttpClientFactory() method.
Constructors
HttpClientRequestSender(HttpClientConfiguration)
Initializes a new instance of the HttpClientRequestSender class with the specified configuration.
public HttpClientRequestSender(HttpClientConfiguration configuration)
Parameters
configuration
HttpClientConfigurationThe HttpClient configuration.
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.