Table of Contents

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 string

Name of the test component.

type TestStepType

Type 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

IReadOnlyCollection<ITestComponent>

Name

Gets component name.

public string Name { get; protected set; }

Property Value

string

Type

Gets a test component type.

public TestStepType Type { get; }

Property Value

TestStepType

Methods

AddComponent(ITestComponent)

Adds a new instance of the TestComponent class to the current object.

public void AddComponent(ITestComponent component)

Parameters

component ITestComponent

The 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 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 the this operation.

Returns

Task

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 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.

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 the this operation.

Returns

Task<bool>

true if the test succeeded; otherwise, false.

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 ITestComponent

The TestComponent instance to remove.

Returns

bool

true if component is successfully removed; otherwise, false. This method also returns false when component was not found.