Table of Contents

Class ComparisonValidator

Namespace
Acuit.Pinpoint.Workflows.Testing.Validation
Assembly
Acuit.Pinpoint.Workflows.Testing.dll

The base class for a data value validator that performs a numerical comparison to a value.

public abstract class ComparisonValidator : IDataValueValidator
Inheritance
ComparisonValidator
Implements
Derived
Inherited Members

Constructors

ComparisonValidator(Func<int, bool>, string)

Initializes a new instance of the ComparisonValidator class.

protected ComparisonValidator(Func<int, bool> compareResultValidator, string displayStringFormat)

Parameters

compareResultValidator Func<int, bool>

The comparison result validator method. It will receive the comparison result from ValidationComparer as its parameter and should return true if that is considered valid. The comparison result will be less than zero if the data value is less than the value evaluted from Value, zero if the data value is equal to the value evaluted from Value, or greater than zero if the data value is greater than the value evaluted from Value.

displayStringFormat string

A format string that can be used to format a criteria expression for the validator, which must contain one format item (e.g., "{0}") for the value evaluted from Value (without units).

Remarks

See ValidationComparer for details about how values are compared.

Exceptions

ArgumentNullException

compareResultValidator is null.

ArgumentNullException

displayStringFormat is null.

Properties

Value

Gets or sets the value against which to perform the comparison. This is required.

public ValueSource Value { get; set; }

Property Value

ValueSource

Methods

InitializeAsync(ActivityContext, IDataValueDescriptor, CancellationToken)

Initializes the validator.

public Task<IInitializedDataValueValidator> InitializeAsync(ActivityContext context, IDataValueDescriptor dataValueDescriptor, CancellationToken cancellationToken)

Parameters

context ActivityContext

The activity context.

dataValueDescriptor IDataValueDescriptor

The data value descriptor.

cancellationToken CancellationToken

A CancellationToken that can request cancellation.

Returns

Task<IInitializedDataValueValidator>

A task that represents the asynchronous operation. The value of its Result property contains an IInitializedDataValueValidator representing the initialized validator.

Exceptions

ArgumentNullException

context is null.

ArgumentNullException

dataValueDescriptor is null.

Exception

The validator could not be initialized. The exception type will depend on the implementation.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.