Table of Contents

Class ValidatedDataValue

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

A validated data value.

public sealed class ValidatedDataValue : IValidatedDataValue, IDataValue, IFormattable, ICriteriaProvider, IEquatable<ValidatedDataValue>, IConvertible
Inheritance
ValidatedDataValue
Implements
Inherited Members
Extension Methods

Constructors

ValidatedDataValue(IDataValue, IInitializedDataValueValidator)

Initializes a new instance of the ValidatedDataValue class, validating the value using a provided initialized validator.

public ValidatedDataValue(IDataValue inner, IInitializedDataValueValidator validator)

Parameters

inner IDataValue

The data value.

validator IInitializedDataValueValidator

The validator to use to validate the value.

Exceptions

ArgumentNullException

inner is null.

ArgumentNullException

validator is null.

ValidatedDataValue(IDataValue, bool, string)

Initializes a new instance of the ValidatedDataValue class.

public ValidatedDataValue(IDataValue inner, bool isValid, string criteria = null)

Parameters

inner IDataValue

The data value.

isValid bool

Whether the value is valid.

criteria string

Optional validation criteria as a human-readable phrase, without units (e.g., "> 10").

Exceptions

ArgumentNullException

inner is null.

Properties

Criteria

Gets the validation criteria as a human-readable phrase, without units (e.g., "> 10"). This should never be null or empty.

public string Criteria { get; }

Property Value

string

Descriptor

Gets the data value descriptor.

public IDataValueDescriptor Descriptor { get; }

Property Value

IDataValueDescriptor

Inner

Gets the inner data value, or null if there is none.

public IDataValue Inner { get; }

Property Value

IDataValue

Remarks

This allows additional data to be added to data values, such as timestamps or validation results.

When this is set for a data value, Value and Descriptor must return the same values as those of Inner.

IsValid

Gets whether the value is valid.

public bool IsValid { get; }

Property Value

bool

Value

Gets the value, which is expected to be immutable.

public object Value { get; }

Property Value

object

Methods

Equals(ValidatedDataValue)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ValidatedDataValue other)

Parameters

other ValidatedDataValue

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

ToString(string, IFormatProvider)

Formats the value of the current instance using the specified format.

public string ToString(string format, IFormatProvider formatProvider)

Parameters

format string

The format to use.-or- A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

formatProvider IFormatProvider

The provider to use to format the value.-or- A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.

Returns

string

The value of the current instance in the specified format.

Operators

operator ==(ValidatedDataValue, ValidatedDataValue)

Returns a value that indicates whether two specified ValidatedDataValue values are equal.

public static bool operator ==(ValidatedDataValue left, ValidatedDataValue right)

Parameters

left ValidatedDataValue

The first value to compare.

right ValidatedDataValue

The second value to compare.

Returns

bool

true if left and right are equal; otherwise, false.

operator !=(ValidatedDataValue, ValidatedDataValue)

Returns a value that indicates whether two specified ValidatedDataValue values are not equal.

public static bool operator !=(ValidatedDataValue left, ValidatedDataValue right)

Parameters

left ValidatedDataValue

The first value to compare.

right ValidatedDataValue

The second value to compare.

Returns

bool

true if left and right are not equal; otherwise, false.