Class TestTransformer<T>

Namespace
Wolfgang.Etl.TestKit
Assembly
Wolfgang.Etl.TestKit.dll

A pass-through transformer for use in tests, examples, and benchmarks. Returns each item unchanged, with no transformation applied.

public class TestTransformer<T> : TransformerBase<T, T, Report>, ITransformWithProgressAndCancellationAsync<T, T, Report>, ITransformWithCancellationAsync<T, T>, ITransformWithProgressAsync<T, T, Report>, ITransformAsync<T, T>

Type Parameters

T

The type of item to transform.

Inheritance
TransformerBase<T, T, Report>
TestTransformer<T>
Implements
ITransformWithProgressAndCancellationAsync<T, T, Report>
ITransformWithCancellationAsync<T, T>
ITransformWithProgressAsync<T, T, Report>
ITransformAsync<T, T>
Inherited Members
TransformerBase<T, T, Report>.CreateProgressReport()
TransformerBase<T, T, Report>.IncrementCurrentItemCount()
TransformerBase<T, T, Report>.IncrementCurrentSkippedItemCount()
TransformerBase<T, T, Report>.ReportingInterval
TransformerBase<T, T, Report>.CurrentItemCount
TransformerBase<T, T, Report>.CurrentSkippedItemCount
TransformerBase<T, T, Report>.MaximumItemCount
TransformerBase<T, T, Report>.SkipItemCount

Examples

var extractor   = new TestExtractor<MyRecord>(items);
var transformer = new TestTransformer<MyRecord>();
var loader      = new TestLoader<MyRecord>(collectItems: true);

await loader.LoadAsync(transformer.TransformAsync(extractor.ExtractAsync()));

Remarks

Useful when a pipeline requires a transformer in the chain but the test or benchmark is focused on the extractor or loader in isolation.

Methods

CreateProgressReport()

Creates a progress report object of type TProgress.

protected override Report CreateProgressReport()

Returns

Report

TProgress - A new instance of the progress report object.

TransformWorkerAsync(IAsyncEnumerable<T>, CancellationToken)

The worker method that performs the actual transformation.

protected override IAsyncEnumerable<T> TransformWorkerAsync(IAsyncEnumerable<T> items, CancellationToken token)

Parameters

items IAsyncEnumerable<T>

IAsyncEnumerable<TSource> - A list of 0 or more items to be transformed

token CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

IAsyncEnumerable<T>