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
IDataValueThe data value.
validator
IInitializedDataValueValidatorThe 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
IDataValueThe data value.
isValid
boolWhether the value is valid.
criteria
stringOptional 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
Descriptor
Gets the data value descriptor.
public IDataValueDescriptor Descriptor { get; }
Property Value
Inner
Gets the inner data value, or null if there is none.
public IDataValue Inner { get; }
Property Value
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
Value
Gets the value, which is expected to be immutable.
public object Value { get; }
Property Value
Methods
Equals(ValidatedDataValue)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ValidatedDataValue other)
Parameters
other
ValidatedDataValueAn object to compare with this object.
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
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
stringThe 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
IFormatProviderThe 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
ValidatedDataValueThe first value to compare.
right
ValidatedDataValueThe second value to compare.
Returns
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
ValidatedDataValueThe first value to compare.
right
ValidatedDataValueThe second value to compare.