Table of Contents

Class ValidationExtensions

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

Validation extension methods.

public static class ValidationExtensions
Inheritance
ValidationExtensions
Inherited Members

Methods

AppendParanthesizedCriteriaTo(ICriteriaProvider, string)

Appends paranthesized criteria to a string, resulting in something like "Value (Criteria)" or like "(Criteria)" if value is null or empty.

public static string AppendParanthesizedCriteriaTo(this ICriteriaProvider criteriaProvider, string value)

Parameters

criteriaProvider ICriteriaProvider

The criteria provider.

value string

The string value to which to append the paranthesized criteria.

Returns

string

value with the paranthesized criteria appended.

Exceptions

ArgumentNullException

criteriaProvider is null.

ApplyOptionalValidatorAsync(ActivityContext, IDataValue, IDataValueValidator, CancellationToken)

Applies an optional validator to a data value.

public static Task<IDataValue> ApplyOptionalValidatorAsync(this ActivityContext context, IDataValue dataValue, IDataValueValidator validator, CancellationToken cancellationToken)

Parameters

context ActivityContext

The activity context.

dataValue IDataValue

The data value.

validator IDataValueValidator

The optional validator.

cancellationToken CancellationToken

A cancellation token that can be used to request canceling initialization of the validator.

Returns

Task<IDataValue>

The resulting data value. See the remarks for details.

Remarks

If a validator is provided, then the validator is initialized and applied to dataValue, replacing any previous validation on that value, if it exists. Otherwise, the original dataValue is returned unchanged.

Exceptions

ArgumentNullException

context is null.

ArgumentNullException

dataValue is null.

InitializeOptionalValidatorAsync(ActivityContext, IDataValueValidator, IDataValueDescriptor, CancellationToken)

public static Task<IInitializedDataValueValidator> InitializeOptionalValidatorAsync(this ActivityContext context, IDataValueValidator validator, IDataValueDescriptor dataValueDescriptor, CancellationToken cancellationToken)

Parameters

context ActivityContext
validator IDataValueValidator
dataValueDescriptor IDataValueDescriptor
cancellationToken CancellationToken

Returns

Task<IInitializedDataValueValidator>

InitializeRequiredValidatorAsync(ActivityContext, IDataValueValidator, string, IDataValueDescriptor, CancellationToken)

public static Task<IInitializedDataValueValidator> InitializeRequiredValidatorAsync(this ActivityContext context, IDataValueValidator validator, string propertyName, IDataValueDescriptor dataValueDescriptor, CancellationToken cancellationToken)

Parameters

context ActivityContext
validator IDataValueValidator
propertyName string
dataValueDescriptor IDataValueDescriptor
cancellationToken CancellationToken

Returns

Task<IInitializedDataValueValidator>