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
ICriteriaProviderThe criteria provider.
value
stringThe 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
ActivityContextThe activity context.
dataValue
IDataValueThe data value.
validator
IDataValueValidatorThe optional validator.
cancellationToken
CancellationTokenA 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
ActivityContextvalidator
IDataValueValidatordataValueDescriptor
IDataValueDescriptorcancellationToken
CancellationToken
Returns
InitializeRequiredValidatorAsync(ActivityContext, IDataValueValidator, string, IDataValueDescriptor, CancellationToken)
public static Task<IInitializedDataValueValidator> InitializeRequiredValidatorAsync(this ActivityContext context, IDataValueValidator validator, string propertyName, IDataValueDescriptor dataValueDescriptor, CancellationToken cancellationToken)
Parameters
context
ActivityContextvalidator
IDataValueValidatorpropertyName
stringdataValueDescriptor
IDataValueDescriptorcancellationToken
CancellationToken