Class TestComponent
- Namespace
- Xping.Sdk.Core.Components
- Assembly
- Xping.Sdk.Core.dll
This abstract class is designed to execute an action or validate test operation that is defined by the derived class.
public abstract class TestComponent : ITestComponent
- Inheritance
-
TestComponent
- Implements
- Derived
- Inherited Members
Constructors
TestComponent(string, TestStepType)
Initializes new instance of the TestComponent class.
protected TestComponent(string name, TestStepType type)
Parameters
name
stringName of the test component.
type
TestStepTypeType of the test component.
Properties
Components
Gets a read-only collection of the child TestComponent instances of the current object.
public IReadOnlyCollection<ITestComponent> Components { get; }
Property Value
Name
Gets component name.
public string Name { get; protected set; }
Property Value
Type
Gets a test component type.
public TestStepType Type { get; }
Property Value
Methods
AddComponent(ITestComponent)
Adds a new instance of the TestComponent class to the current object.
public void AddComponent(ITestComponent component)
Parameters
component
ITestComponentThe TestComponent instance to add.
HandleAsync(Uri, TestSettings, TestContext, IServiceProvider, CancellationToken)
This method performs the test step operation asynchronously. It is an abstract method that must be implemented by the subclass.
public abstract 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 the this operation.
Returns
ProbeAsync(Uri, TestSettings, IServiceProvider, CancellationToken)
Asynchronously performs a probe test on the specified URL using the specified settings.
public virtual Task<bool> ProbeAsync(Uri url, TestSettings settings, 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.
serviceProvider
IServiceProviderAn instance object of a mechanism for retrieving a service object.
cancellationToken
CancellationTokenAn optional CancellationToken object that can be used to cancel the this operation.
Returns
Remarks
This method is only meant for quick test validation and is stateless.
RemoveComponent(ITestComponent)
Removes the specified instance of the TestComponent class from the current object.
public bool RemoveComponent(ITestComponent component)
Parameters
component
ITestComponentThe TestComponent instance to remove.
Returns
- bool
true
if component is successfully removed; otherwise,false
. This method also returnsfalse
when component was not found.