diff --git a/JMayer.Data/DataAnnotations/CompareToOtherMemberAttribute.cs b/JMayer.Data/DataAnnotations/CompareToOtherMemberAttribute.cs
new file mode 100644
index 0000000..063c606
--- /dev/null
+++ b/JMayer.Data/DataAnnotations/CompareToOtherMemberAttribute.cs
@@ -0,0 +1,472 @@
+using System.ComponentModel.DataAnnotations;
+using System.Reflection;
+
+namespace JMayer.Data.DataAnnotations;
+
+///
+/// The class does a value comparison with the public property the attribute is registered too and another public property
+/// on the same class and instance being validated. The following types are supported: bool, byte, sbyte, short, ushort, int,
+/// uint, long, ulong, float, double, decimal, char, string, DateTime, DateOffset, DateOnly, TimeOnly, Timespan and Enum. Nullable is
+/// also supported for the listed types. The following comparison operations are suppored: ==, !=, <, <=, >, and
+/// >=; bool, char, string and Enum only support == and !=.
+///
+///
+/// To use, add the attribute to the public property that needs to be compared with another public property in the same class.
+/// Set the otherMemberName to the name of the other public property which needs to be compared against. Set the comparisonOperation
+/// to the operation that needs to be preformed when the comparison is done. Set the passRegisteredMemberIfNull to true if the attribute's
+/// registered member can be null and you don't want the comparison to fail because the member is set to null. Set the passOtherMemberIfNull
+/// to true if the other member can be null and you don't want the comparison to fail because the member is set to null.
+///
+/// public class ObjectRequiringValidation
+/// {
+/// //IntMember will need to be less than OtherIntMember in order to pass validation.
+/// [CompareToOtherMember(otherMemberName: nameof(OtherIntMember), comparisonOperation: ComparisonOperation.LessThan, passRegisteredMemberIfNull: false, passOtherMemberIfNull: false)]
+/// public int IntMember { get; set; }
+///
+/// public int OtherIntMember { get; set; }
+/// }
+///
+///
+[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
+public sealed class CompareToOtherMemberAttribute : ValidationAttribute
+{
+ ///
+ /// The operation used when the CompareToOtherMember data annotation does the comparison.
+ ///
+ private readonly ComparisonOperation _comparisonOperation;
+
+ ///
+ /// The name of the other member the CompareToOtherMember data annotation will compare against.
+ ///
+ private readonly string _otherMemberName;
+
+ ///
+ /// Allows the CompareToOtherMember data annotation to return success if the other member is null.
+ ///
+ private readonly bool _passOtherMemberIfNull;
+
+ ///
+ /// Allows the CompareToOtherMember data annotation to return success if the member this attribute is registered on is null.
+ ///
+ private readonly bool _passRegisteredMemberIfNull;
+
+ ///
+ /// The constant for the invalid comparison for boolean values error message.
+ ///
+ internal const string InvalidComparisonForBoolErrorMessage = "Failed to validate because an equal and not equal comparison is only allowed for boolean values.";
+
+ ///
+ /// The constant for the invalid comparison for char values error message.
+ ///
+ internal const string InvalidComparisonForCharErrorMessage = "Failed to validate because an equal and not equal comparison is only allowed for character values.";
+
+ ///
+ /// The constant for the invalid comparison for Enum values error message.
+ ///
+ internal const string InvalidComparisonForEnumErrorMessage = "Failed to validate because an equal and not equal comparison is only allowed for Enum values.";
+
+ ///
+ /// The constant for the invalid comparison for string values error message.
+ ///
+ internal const string InvalidComparisonForStringErrorMessage = "Failed to validate because an equal and not equal comparison is only allowed for string values.";
+
+ ///
+ /// The constructor which takes the comparison info.
+ ///
+ /// The name of the other member the CompareToOtherMember data annotation will compare against.
+ /// The operation used when the CompareToOtherMember data annotation does the comparison.
+ /// Allows the CompareToOtherMember data annotation to return success if the member this attribute is registered on is null.
+ /// Allows the CompareToOtherMember data annotation to return success if the other member is null.
+ /// Thrown when the otherMemberName parameter is null or an empty string.
+ public CompareToOtherMemberAttribute(string otherMemberName, ComparisonOperation compareToOperation, bool passRegisteredMemberIfNull = false, bool passOtherMemberIfNull = false)
+ {
+ ArgumentException.ThrowIfNullOrEmpty(otherMemberName);
+
+ _comparisonOperation = compareToOperation;
+ _otherMemberName = otherMemberName;
+ _passOtherMemberIfNull = passOtherMemberIfNull;
+ _passRegisteredMemberIfNull = passRegisteredMemberIfNull;
+ }
+
+ ///
+ /// The method returns if the character values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckCharacterComparison(char registeredMemberValue, char otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue == otherMemberValue,
+ ComparisonOperation.NotEqual => registeredMemberValue != otherMemberValue,
+ _ => false
+ };
+ }
+
+ ///
+ /// The method returns if the bool values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckBoolValues(bool registeredMemberValue, bool otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue == otherMemberValue,
+ ComparisonOperation.NotEqual => registeredMemberValue != otherMemberValue,
+ _ => false
+ };
+ }
+
+ ///
+ /// The method returns if the date values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckDateValues(DateTime registeredMemberValue, DateTime otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue == otherMemberValue,
+ ComparisonOperation.GreaterThan => registeredMemberValue > otherMemberValue,
+ ComparisonOperation.GreaterThanOrEqual => registeredMemberValue >= otherMemberValue,
+ ComparisonOperation.LessThan => registeredMemberValue < otherMemberValue,
+ ComparisonOperation.LessThanOrEqual => registeredMemberValue <= otherMemberValue,
+ ComparisonOperation.NotEqual => registeredMemberValue != otherMemberValue,
+ _ => false
+ };
+ }
+
+ ///
+ /// The method returns if the date values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckDateValues(DateTimeOffset registeredMemberValue, DateTimeOffset otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue == otherMemberValue,
+ ComparisonOperation.GreaterThan => registeredMemberValue > otherMemberValue,
+ ComparisonOperation.GreaterThanOrEqual => registeredMemberValue >= otherMemberValue,
+ ComparisonOperation.LessThan => registeredMemberValue < otherMemberValue,
+ ComparisonOperation.LessThanOrEqual => registeredMemberValue <= otherMemberValue,
+ ComparisonOperation.NotEqual => registeredMemberValue != otherMemberValue,
+ _ => false
+ };
+ }
+
+ ///
+ /// The method returns if the date values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckDateValues(DateOnly registeredMemberValue, DateOnly otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue == otherMemberValue,
+ ComparisonOperation.GreaterThan => registeredMemberValue > otherMemberValue,
+ ComparisonOperation.GreaterThanOrEqual => registeredMemberValue >= otherMemberValue,
+ ComparisonOperation.LessThan => registeredMemberValue < otherMemberValue,
+ ComparisonOperation.LessThanOrEqual => registeredMemberValue <= otherMemberValue,
+ ComparisonOperation.NotEqual => registeredMemberValue != otherMemberValue,
+ _ => false
+ };
+ }
+
+ ///
+ /// The method returns if the decimal values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckDecimalValues(decimal registeredMemberValue, decimal otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue == otherMemberValue,
+ ComparisonOperation.GreaterThan => registeredMemberValue > otherMemberValue,
+ ComparisonOperation.GreaterThanOrEqual => registeredMemberValue >= otherMemberValue,
+ ComparisonOperation.LessThan => registeredMemberValue < otherMemberValue,
+ ComparisonOperation.LessThanOrEqual => registeredMemberValue <= otherMemberValue,
+ ComparisonOperation.NotEqual => registeredMemberValue != otherMemberValue,
+ _ => false
+ };
+ }
+
+ ///
+ /// The method returns if the double values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckDoubleValues(double registeredMemberValue, double otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue == otherMemberValue,
+ ComparisonOperation.GreaterThan => registeredMemberValue > otherMemberValue,
+ ComparisonOperation.GreaterThanOrEqual => registeredMemberValue >= otherMemberValue,
+ ComparisonOperation.LessThan => registeredMemberValue < otherMemberValue,
+ ComparisonOperation.LessThanOrEqual => registeredMemberValue <= otherMemberValue,
+ ComparisonOperation.NotEqual => registeredMemberValue != otherMemberValue,
+ _ => false
+ };
+ }
+
+ ///
+ /// The method returns if the enum values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckEnumValues(Enum registeredMemberValue, Enum otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue.Equals(otherMemberValue),
+ ComparisonOperation.NotEqual => registeredMemberValue.Equals(otherMemberValue) is false,
+ _ => false
+ };
+ }
+
+ ///
+ /// The method returns if the integer values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckIntegerValues(long registeredMemberValue, long otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue == otherMemberValue,
+ ComparisonOperation.GreaterThan => registeredMemberValue > otherMemberValue,
+ ComparisonOperation.GreaterThanOrEqual => registeredMemberValue >= otherMemberValue,
+ ComparisonOperation.LessThan => registeredMemberValue < otherMemberValue,
+ ComparisonOperation.LessThanOrEqual => registeredMemberValue <= otherMemberValue,
+ ComparisonOperation.NotEqual => registeredMemberValue != otherMemberValue,
+ _ => false
+ };
+ }
+
+ ///
+ /// The method returns if the string values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckStringValues(string registeredMemberValue, string otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue == otherMemberValue,
+ ComparisonOperation.NotEqual => registeredMemberValue != otherMemberValue,
+ _ => false
+ };
+ }
+
+ ///
+ /// The method returns if the time values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckTimeValues(TimeOnly registeredMemberValue, TimeOnly otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue == otherMemberValue,
+ ComparisonOperation.GreaterThan => registeredMemberValue > otherMemberValue,
+ ComparisonOperation.GreaterThanOrEqual => registeredMemberValue >= otherMemberValue,
+ ComparisonOperation.LessThan => registeredMemberValue < otherMemberValue,
+ ComparisonOperation.LessThanOrEqual => registeredMemberValue <= otherMemberValue,
+ ComparisonOperation.NotEqual => registeredMemberValue != otherMemberValue,
+ _ => false
+ };
+ }
+
+ ///
+ /// The method returns if the time values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckTimeValues(TimeSpan registeredMemberValue, TimeSpan otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue == otherMemberValue,
+ ComparisonOperation.GreaterThan => registeredMemberValue > otherMemberValue,
+ ComparisonOperation.GreaterThanOrEqual => registeredMemberValue >= otherMemberValue,
+ ComparisonOperation.LessThan => registeredMemberValue < otherMemberValue,
+ ComparisonOperation.LessThanOrEqual => registeredMemberValue <= otherMemberValue,
+ ComparisonOperation.NotEqual => registeredMemberValue != otherMemberValue,
+ _ => false
+ };
+ }
+
+ ///
+ /// The method returns if the unsigned integer values pass the comparison.
+ ///
+ /// The value of the member the attribute is registered too.
+ /// The value of the other member.
+ /// True means the comparison passed.
+ private bool CheckUnsignedIntegerValues(ulong registeredMemberValue, ulong otherMemberValue)
+ {
+ return _comparisonOperation switch
+ {
+ ComparisonOperation.Equal => registeredMemberValue == otherMemberValue,
+ ComparisonOperation.GreaterThan => registeredMemberValue > otherMemberValue,
+ ComparisonOperation.GreaterThanOrEqual => registeredMemberValue >= otherMemberValue,
+ ComparisonOperation.LessThan => registeredMemberValue < otherMemberValue,
+ ComparisonOperation.LessThanOrEqual => registeredMemberValue <= otherMemberValue,
+ ComparisonOperation.NotEqual => registeredMemberValue != otherMemberValue,
+ _ => false
+ };
+ }
+
+ ///
+ /// Overridden to compare the member the attribute is registered too and an another member on the instance.
+ protected override ValidationResult? IsValid(object? value, ValidationContext validationContext)
+ {
+ if (_otherMemberName == validationContext.MemberName)
+ {
+ return new ValidationResult(DataAnnotationMemberHelper.SameMemberErrorMessage);
+ }
+
+ MemberInfo? registeredMemberInfo = validationContext.ObjectType.FindMembers(MemberTypes.Property, BindingFlags.Public | BindingFlags.Instance, Type.FilterName, validationContext.MemberName).FirstOrDefault();
+
+ if (registeredMemberInfo is null)
+ {
+ return new ValidationResult(DataAnnotationMemberHelper.MemberNotFoundErrorMessage);
+ }
+
+ MemberInfo? otherMemberInfo = validationContext.ObjectType.FindMembers(MemberTypes.Property, BindingFlags.Public | BindingFlags.Instance, Type.FilterName, _otherMemberName).FirstOrDefault();
+
+ if (otherMemberInfo is null)
+ {
+ return new ValidationResult(DataAnnotationMemberHelper.MemberNotFoundErrorMessage);
+ }
+
+ if (DataAnnotationMemberHelper.IsSameType(registeredMemberInfo, otherMemberInfo) is false)
+ {
+ return new ValidationResult(DataAnnotationMemberHelper.TypeMismatchErrorMessage);
+ }
+
+ object? otherMemberValue = DataAnnotationMemberHelper.GetMemberValue(otherMemberInfo, validationContext.ObjectInstance);
+
+ if (_passRegisteredMemberIfNull && value is null)
+ {
+ return ValidationResult.Success;
+ }
+ else if (_passOtherMemberIfNull && otherMemberValue is null)
+ {
+ return ValidationResult.Success;
+ }
+
+ bool success = false;
+
+ if (value is bool registeredMemberBoolValue && otherMemberValue is bool otherMemberBoolValue)
+ {
+ //Only equal and not equal are supported for this type.
+ if (_comparisonOperation is not ComparisonOperation.Equal and not ComparisonOperation.NotEqual)
+ {
+ return new ValidationResult(InvalidComparisonForBoolErrorMessage);
+ }
+
+ success = CheckBoolValues(registeredMemberBoolValue, otherMemberBoolValue);
+ }
+ else if (value is sbyte or short or int or long && otherMemberValue is sbyte or short or int or long)
+ {
+ success = CheckIntegerValues(Convert.ToInt64(value), Convert.ToInt64(otherMemberValue));
+ }
+ else if (value is byte or ushort or uint or ulong && otherMemberValue is byte or ushort or uint or ulong)
+ {
+ success = CheckUnsignedIntegerValues(Convert.ToUInt64(value), Convert.ToUInt64(otherMemberValue));
+ }
+ else if (value is float or double && otherMemberValue is float or double)
+ {
+ success = CheckDoubleValues(Convert.ToDouble(value), Convert.ToDouble(otherMemberValue));
+ }
+ else if (value is decimal && otherMemberValue is decimal)
+ {
+ success = CheckDecimalValues(Convert.ToDecimal(value), Convert.ToDecimal(otherMemberValue));
+ }
+ else if (value is char registeredMemberdCharacterValue && otherMemberValue is char otherMemberdCharacterValue)
+ {
+ //Only equal and not equal are supported for this type.
+ if (_comparisonOperation is not ComparisonOperation.Equal and not ComparisonOperation.NotEqual)
+ {
+ return new ValidationResult(InvalidComparisonForCharErrorMessage);
+ }
+
+ success = CheckCharacterComparison(registeredMemberdCharacterValue, otherMemberdCharacterValue);
+ }
+ else if (value is string registeredMemberdStringValue && otherMemberValue is string otherMemberdStringValue)
+ {
+ //Only equal and not equal are supported for this type.
+ if (_comparisonOperation is not ComparisonOperation.Equal and not ComparisonOperation.NotEqual)
+ {
+ return new ValidationResult(InvalidComparisonForStringErrorMessage);
+ }
+
+ success = CheckStringValues(registeredMemberdStringValue, otherMemberdStringValue);
+ }
+ else if (value is DateTime registeredMemberDateValue && otherMemberValue is DateTime otherMemberDateValue)
+ {
+ success = CheckDateValues(registeredMemberDateValue, otherMemberDateValue);
+ }
+ else if (value is DateTimeOffset registeredMemberDateOffsetValue && otherMemberValue is DateTimeOffset otherMemberDateOffsetValue)
+ {
+ success = CheckDateValues(registeredMemberDateOffsetValue, otherMemberDateOffsetValue);
+ }
+ else if (value is DateOnly registeredMemberDateOnlyValue && otherMemberValue is DateOnly otherMemberDateOnlyValue)
+ {
+ success = CheckDateValues(registeredMemberDateOnlyValue, otherMemberDateOnlyValue);
+ }
+ else if (value is TimeOnly registeredMemberTimeOnlyValue && otherMemberValue is TimeOnly otherMemberTimeOnlyValue)
+ {
+ success = CheckTimeValues(registeredMemberTimeOnlyValue, otherMemberTimeOnlyValue);
+ }
+ else if (value is TimeSpan registeredMemberTimeValue && otherMemberValue is TimeSpan otherMemberTimeValue)
+ {
+ success = CheckTimeValues(registeredMemberTimeValue, otherMemberTimeValue);
+ }
+ else if (value is Enum registeredMemberEnumValue && otherMemberValue is Enum otherMemberEnumValue)
+ {
+ //Only equal and not equal are supported for this type.
+ if (_comparisonOperation is not ComparisonOperation.Equal and not ComparisonOperation.NotEqual)
+ {
+ return new ValidationResult(InvalidComparisonForEnumErrorMessage);
+ }
+
+ success = CheckEnumValues(registeredMemberEnumValue, otherMemberEnumValue);
+ }
+ //At this point, the type must not be supported.
+ else if (value is not null && otherMemberValue is not null)
+ {
+ return new ValidationResult(DataAnnotationMemberHelper.InvalidTypeErrorMessage);
+ }
+
+ if (success is false)
+ {
+ if (validationContext.MemberName is not null)
+ {
+ return new ValidationResult(ErrorMessage, [validationContext.MemberName, _otherMemberName]);
+ }
+ else
+ {
+ return new ValidationResult(ErrorMessage, [_otherMemberName]);
+ }
+ }
+
+ return ValidationResult.Success;
+ }
+}
diff --git a/JMayer.Data/DataAnnotations/ComparisonOperation.cs b/JMayer.Data/DataAnnotations/ComparisonOperation.cs
new file mode 100644
index 0000000..d5e3195
--- /dev/null
+++ b/JMayer.Data/DataAnnotations/ComparisonOperation.cs
@@ -0,0 +1,43 @@
+namespace JMayer.Data.DataAnnotations;
+
+///
+/// The enumeration for the comparison operations.
+///
+public enum ComparisonOperation
+{
+ ///
+ /// The CompareToOtherMember attribute will do an equal check on the member its registered too against
+ /// another member.
+ ///
+ Equal = 0,
+
+ ///
+ /// The CompareToOtherMember attribute will do a not equal check on the member its registered too against
+ /// another member.
+ ///
+ NotEqual,
+
+ ///
+ /// The CompareToOtherMember attribute will do a greater than check on the member its registered too against
+ /// another member.
+ ///
+ GreaterThan,
+
+ ///
+ /// The CompareToOtherMember attribute will do a greater than or equal check on the member its registered too against
+ /// another member.
+ ///
+ GreaterThanOrEqual,
+
+ ///
+ /// The CompareToOtherMember attribute will do a less than check on the member its registered too against
+ /// another member.
+ ///
+ LessThan,
+
+ ///
+ /// The CompareToOtherMember attribute will do a less than or equal check on the member its registered too against
+ /// another member.
+ ///
+ LessThanOrEqual,
+}
diff --git a/JMayer.Data/DataAnnotations/DataAnnotationMemberHelper.cs b/JMayer.Data/DataAnnotations/DataAnnotationMemberHelper.cs
new file mode 100644
index 0000000..a21dddd
--- /dev/null
+++ b/JMayer.Data/DataAnnotations/DataAnnotationMemberHelper.cs
@@ -0,0 +1,107 @@
+using System.Reflection;
+
+namespace JMayer.Data.DataAnnotations;
+
+///
+/// The static class contains common contants and methods for member access.
+///
+internal static class DataAnnotationMemberHelper
+{
+ ///
+ /// The constant for an invalid type error message.
+ ///
+ public const string InvalidTypeErrorMessage = "Failed to vaidate because the type is not supported.";
+
+ ///
+ /// The constant for the member not found error message.
+ ///
+ public const string MemberNotFoundErrorMessage = "Failed to validate because the member name was not found.";
+
+ ///
+ /// The constant for the same member error message.
+ ///
+ public const string SameMemberErrorMessage = "Failed to validate because the other member name is the same as the member name the attribute's registered too.";
+
+ ///
+ /// The constant for the type mismatch error message.
+ ///
+ public const string TypeMismatchErrorMessage = "Failed to validate because there is a type mismatch between the values being compared.";
+
+ ///
+ /// The method returns the type from the member info.
+ ///
+ /// The information on the member.
+ /// The type or null if member is not a field or property.
+ public static Type? GetMemberType(MemberInfo memberInfo)
+ {
+ if (memberInfo is PropertyInfo propertyInfo)
+ {
+ return propertyInfo.PropertyType;
+ }
+
+ return null;
+ }
+
+ ///
+ /// The method returns the value stored a member.
+ ///
+ /// Meta data about the member.
+ /// The instance of the object being validated.
+ /// The value or null if not found.
+ public static object? GetMemberValue(MemberInfo memberInfo, object objectInstance)
+ {
+ if (memberInfo is PropertyInfo propertyInfo)
+ {
+ return propertyInfo.GetValue(objectInstance);
+ }
+
+ return null;
+ }
+
+ ///
+ /// The method returns if the members are the same type or not.
+ ///
+ /// The information on the member in the validation context.
+ /// The information on the other member.
+ /// True means the types are the same.
+ public static bool IsSameType(MemberInfo registeredMemberInfo, MemberInfo otherMemberInfo)
+ {
+ Type? registeredMemberType = GetMemberType(registeredMemberInfo);
+
+ if (registeredMemberType is null)
+ {
+ return false;
+ }
+
+ //Get the underlying type if nullable.
+ if (registeredMemberType.IsGenericType && registeredMemberType.GetGenericTypeDefinition() == typeof(Nullable<>))
+ {
+ registeredMemberType = Nullable.GetUnderlyingType(registeredMemberType);
+
+ if (registeredMemberType is null)
+ {
+ return false;
+ }
+ }
+
+ Type? otherMemberType = GetMemberType(otherMemberInfo);
+
+ if (otherMemberType is null)
+ {
+ return false;
+ }
+
+ //Get the underlying type if nullable.
+ if (otherMemberType.IsGenericType && otherMemberType.GetGenericTypeDefinition() == typeof(Nullable<>))
+ {
+ otherMemberType = Nullable.GetUnderlyingType(otherMemberType);
+
+ if (otherMemberType is null)
+ {
+ return false;
+ }
+ }
+
+ return registeredMemberType == otherMemberType;
+ }
+}
diff --git a/JMayer.Data/DataAnnotations/RequiredDependsOnAttribute.cs b/JMayer.Data/DataAnnotations/RequiredDependsOnAttribute.cs
new file mode 100644
index 0000000..72df9dc
--- /dev/null
+++ b/JMayer.Data/DataAnnotations/RequiredDependsOnAttribute.cs
@@ -0,0 +1,130 @@
+using System.ComponentModel.DataAnnotations;
+using System.Reflection;
+
+namespace JMayer.Data.DataAnnotations;
+
+///
+/// The class does the required data annotation check if it matches a specific condition on another property in the same class and instance being validated.
+/// The condition can be a boolean or an enum value.
+///
+///
+/// To use, add the attribute to the public property which is required on a condition. Set the dependentMemberName to the name of the public property
+/// which has the condition that needs to be evaluated. Set the conditionValue to true, false or an enum value based on what condition needs to occur for the required
+/// data annotation to be evaluated.
+///
+/// public class ObjectRequiringValidation
+/// {
+/// //A required validation check will be done if DependentBoolMember is true.
+/// [RequiredDependsOn(dependentMemberName: nameof(DependentBoolMember), conditionValue: true)]
+/// public string ConditionalRequiredProperty { get; set; }
+///
+/// public bool DependentBoolMember { get; set; }
+/// }
+///
+/// or
+///
+/// public class ObjectRequiringValidation
+/// {
+/// //A required validation check will be done if DependentEnumMember is YourEnum.RequiredValue.
+/// [RequiredDependsOn(dependentMemberName: nameof(DependentEnumMember), conditionValue: YourEnum.RequiredValue)]
+/// public string ConditionalRequiredProperty { get; set; }
+///
+/// public YourEnum DependentEnumMember { get; set; }
+/// }
+///
+///
+[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
+public sealed class RequiredDependsOnAttribute : RequiredAttribute
+{
+ ///
+ /// The value to run the Required data annotation.
+ ///
+ private readonly object _conditionValue;
+
+ ///
+ /// The name of the member the Required data annotation is dependent on.
+ ///
+ private readonly string _dependentMemberName;
+
+ ///
+ /// The constructor which takes the dependency and condition.
+ ///
+ /// The name of the member the Required data annotation is dependent on.
+ /// The value to run the Required data annotation.
+ /// Thrown when the dependentMemberName parameter is null or an empty string.
+ /// Thrown when the conditionValue parameter is null.
+ public RequiredDependsOnAttribute(string dependentMemberName, object conditionValue)
+ {
+ ArgumentNullException.ThrowIfNull(conditionValue);
+ ArgumentException.ThrowIfNullOrEmpty(dependentMemberName);
+
+ _conditionValue = conditionValue;
+ _dependentMemberName = dependentMemberName;
+ }
+
+ ///
+ /// The method returns if the dependent member matches the required condition.
+ ///
+ /// The bool value of the dependent member.
+ /// The bool value we are expecting for the dependent member.
+ /// True means the Required data annotation check occurs.
+ private static bool IsRequiredCondition(bool dependentMemberValue, bool conditionValue) => dependentMemberValue == conditionValue;
+
+ ///
+ /// The method returns if the dependent member matches the required condition.
+ ///
+ /// The bool value of the dependent member.
+ /// The bool value we are expecting for the dependent member.
+ /// True means the Required data annotation check occurs.
+ private static bool IsRequiredCondition(Enum dependentMemberValue, Enum conditionValue) => dependentMemberValue.Equals(conditionValue);
+
+ ///
+ /// Overridden to run the required data annotation if it matches the dependent condition. Success will be return when it doesn't match the dependent condition.
+ protected override ValidationResult? IsValid(object? value, ValidationContext validationContext)
+ {
+ if (_dependentMemberName == validationContext.MemberName)
+ {
+ return new ValidationResult(DataAnnotationMemberHelper.SameMemberErrorMessage);
+ }
+
+ MemberInfo? dependentMemberInfo = validationContext.ObjectType.FindMembers(MemberTypes.Property, BindingFlags.Public | BindingFlags.Instance, Type.FilterName, _dependentMemberName).FirstOrDefault();
+
+ if (dependentMemberInfo is null)
+ {
+ return new ValidationResult(DataAnnotationMemberHelper.MemberNotFoundErrorMessage);
+ }
+
+ object? dependentMemberValue = DataAnnotationMemberHelper.GetMemberValue(dependentMemberInfo, validationContext.ObjectInstance);
+
+ if (dependentMemberValue is null)
+ {
+ return ValidationResult.Success;
+ }
+
+ if (dependentMemberValue.GetType() != _conditionValue.GetType())
+ {
+ return new ValidationResult(DataAnnotationMemberHelper.TypeMismatchErrorMessage);
+ }
+
+ if (dependentMemberValue is bool dependentMemberBoolValue && _conditionValue is bool conditionBoolValue)
+ {
+ if (IsRequiredCondition(dependentMemberBoolValue, conditionBoolValue))
+ {
+ return base.IsValid(value, validationContext);
+ }
+ }
+ else if (dependentMemberValue is Enum dependentMemberEnumValue && _conditionValue is Enum conditionEnumValue)
+ {
+ if (IsRequiredCondition(dependentMemberEnumValue, conditionEnumValue))
+ {
+ return base.IsValid(value, validationContext);
+ }
+ }
+ else
+ {
+ return new ValidationResult(DataAnnotationMemberHelper.InvalidTypeErrorMessage);
+ }
+
+ return ValidationResult.Success;
+ }
+}
diff --git a/JMayer.Data/JMayer.Data.csproj b/JMayer.Data/JMayer.Data.csproj
index 3563567..22ff1b0 100644
--- a/JMayer.Data/JMayer.Data.csproj
+++ b/JMayer.Data/JMayer.Data.csproj
@@ -4,7 +4,7 @@
net9.0
enable
enable
- 9.0.0
+ 9.1.0
jmayer913
jmayer913
Package contains generic data access via HTTP or a Database.
diff --git a/README.md b/README.md
index c6bfb34..9ee09fe 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,7 @@
This library will help you define the data your application utilizes. It will also help you define a common interface your application will use when accessing or manipulating data objects in a database or a remote server.
## Data Object
-A data object is used to represent data accessed through the data layer and used by your application. For example, your application displays banking accounts for a user so your application will need an Account object and it would need properties like AccountType and TotalAmount to describe the account. Using the library,
-you would define an Account object as such:
+A data object is used to represent data accessed through the data layer and used by your application. For example, your application displays banking accounts for a user so your application will need an Account object and it would need properties like AccountType and TotalAmount to describe the account. Using the library, you would define an Account object as such:
```
public class Account : DataObject
{
@@ -26,10 +25,8 @@ public class Account : DataObject
The library is built on the idea you create a class which represents your data and it inherits from one of the two base classes defined in the library. Each base class describes the data in certain ways.
### Data Object Class
-This contains an identifier the record in a database table or collection and there are two properties, an Integer64ID property and StringID property, and **the library expects you to choose if either one or both are used by your application and your data layers.** Also, included is a CreatedOn and LastEditedOn properties which keep track of when
-the data object was created and when it was lasted edited. Additionally, there are common optional properties, Name, Description, LastEditedBy (a user name), LastEditedByInteger64ID (if integer identifiers are used) and LastEditedByStringID (if string identifiers are used).
-
-
+This contains an identifier the record in a database table or collection and there are two properties, an Integer64ID property and StringID property, and **the library expects you to choose if either one or both are used by your application and your data layers.** Also, included is a CreatedOn and LastEditedOn properties which keep track of when the data object was created and when it was lasted edited. Additionally, there are common optional properties, Name, Description, LastEditedBy (a user name), LastEditedByInteger64ID (if integer identifiers are used) and LastEditedByStringID (if string identifiers are used).
+
There is an overridable MapProperties() method which you can override it in your subclasses to define how data is copied from one data object to another. There is also a Validate() method which can be used by the data layer to validate the data of the object; this uses data annotations.
#### Data Annotations
@@ -61,10 +58,8 @@ public class Account : DataObject
### Sub Data Object Class
This represents data that's relationally under something else; think *this* has *that* and *that* would be the sub of *this*. Like the DataObject class, it has two owner identifier properties, OwnerInteger64ID and OwnerStringID, and these will reference an owner data object. **The library expects you to choose if either one or both are used by your application and your data layers.**
-
-
-Going back to the banking example, an account will have transactions taken by the user or externally (auto deposit/withdrawl) so that's something your application would need to display. Your application would need a Transaction object and you would need to set the owner identifier property to the identifier of the Account object. This defines
-a relationship between the Account object and Transaction object.
+
+Going back to the banking example, an account will have transactions taken by the user or externally (auto deposit/withdrawl) so that's something your application would need to display. Your application would need a Transaction object and you would need to set the owner identifier property to the identifier of the Account object. This defines a relationship between the Account object and Transaction object.
```
public class Transaction : SubDataObject
{
@@ -99,20 +94,16 @@ This is not a data object but its derived from the DataObject or SubDataObject.
## Data Layer
Your application will use the data layer to access or manipulate data objects. The data layer will act as a wrapper for the database or a remote server. This abstraction allows your application to only know about the data objects and the data layers and not how its needs to talk to the source.
-
-
-This library defines two types of data layers, database and HTTP. Both have interfaces that define common data access/manipulation. For the database side, this library only contains memory storage data layers and these are meant more for prototyping or example projects. For the HTTP side, this library contains HTTP data layers meant
-for communicating with a web API and these use the System.Net.Http.HttpClient class.
-
-
+
+This library defines two types of data layers, database and HTTP. Both have interfaces that define common data access/manipulation. For the database side, this library only contains memory storage data layers and these are meant more for prototyping or example projects. For the HTTP side, this library contains HTTP data layers meant for communicating with a web API and these use the System.Net.Http.HttpClient class.
+
The data layer classes in the library are generic. The library is built on the idea you create a sub data layer class from whichever base data layer class you need and define which data object the data layer will represent. This creates a strongly typed association between the data object and data layer.
### Memory Storage Data Layer
**First, let's start off by saying the memory storage data layer uses an auto incrementing long identity as the identifier so this means your application needs to use the DataObject.Integer64ID property when interacting with a data object and its data layer.**
#### How to Create Your Memory Storage Data Layer
-Going back to our banking account example, your application needs a way to interact with the account data so you need to define an interface for your account data layer and an account data layer sub class which inherits from StandardCRUDDataLayer in the JMayer.Data.Database.DataLayer.MemoryStorage namespace. Optionally, the data layer would need to be
-registered to the middleware in the Program.cs; this allows for depedency injection if your application utilizes it.
+Going back to our banking account example, your application needs a way to interact with the account data so you need to define an interface for your account data layer and an account data layer sub class which inherits from StandardCRUDDataLayer in the JMayer.Data.Database.DataLayer.MemoryStorage namespace. Optionally, the data layer would need to be registered to the middleware in the Program.cs; this allows for depedency injection if your application utilizes it.
```
public interface IAccountDataLayer : IStandardCRUDDataLayer
{
@@ -135,8 +126,7 @@ Account account = await accountDataLayer.CreateAsync(new Account()
TotalAmount = 100.00,
});
```
-The CreateAsync() method can take a single object or a list. ValidateAsync() will be called for each data object; base functionality checks the data annotations on the object but the ValidateAsync() method can be overridden to add additional validation checks. Any validation issue will throw a DataObjectValidationException. The Created event will
-also be called after all the data objects have been inserted into the list. If your application needs to react to the creation in some way, you can register an event handler with the Created event.
+The CreateAsync() method can take a single object or a list. ValidateAsync() will be called for each data object; base functionality checks the data annotations on the object but the ValidateAsync() method can be overridden to add additional validation checks. Any validation issue will throw a DataObjectValidationException. The Created event will also be called after all the data objects have been inserted into the list. If your application needs to react to the creation in some way, you can register an event handler with the Created event.
#### How to Delete a Data Object Using Your Memory Storage Data Layer
```
@@ -151,9 +141,7 @@ The DeleteAsync() method can take a single object or a list. It can also take an
account.TotalAmount = 250.00;
account = await accountDataLayer.UpdateAsync(account);
```
-The UpdateAsync() method can take a single object or a list. ValidateAsync() will be called for each data object; base functionality checks the data annotations on the object but the ValidateAsync() method can be overridden to add additional validation checks. Any validation issue will throw a DataObjectValidationException. Additionally, the existence
-of each data object will be confirmed in the list (this is before the list is update) and if any are missing, an DataObjectIDNotFoundException will be thrown. The Updated event will also be called after all the data objects have been updated in the list. If your application needs to react to the update in some way, you can register an event handler with the
-Updated event.
+The UpdateAsync() method can take a single object or a list. ValidateAsync() will be called for each data object; base functionality checks the data annotations on the object but the ValidateAsync() method can be overridden to add additional validation checks. Any validation issue will throw a DataObjectValidationException. Additionally, the existence of each data object will be confirmed in the list (this is before the list is update) and if any are missing, an DataObjectIDNotFoundException will be thrown. The Updated event will also be called after all the data objects have been updated in the list. If your application needs to react to the update in some way, you can register an event handler with the Updated event.
#### How to Get Data Objects Using Your Memory Storage Data Layer
```
@@ -304,9 +292,7 @@ public class AccountDataLayer : StandardCRUDDataLayer, IAccountDataLaye
}
}
```
-The base has a QueryData() method you can call; you can either pass in a QueryDefinition object or linq for a where predicate and/or linq for an order predicate and/or bool for ascending/descending order. If for some reason, you need direct access to the list, it can be accessed with the DataStorage property but it will require a
-lock(DataStorageLock) { ... } statement in order to maintain thread-safety. If for some reason, the CreateAsync() method needs to be overridden, to access the identity, use the Identity property and to increment the identity use the IncrementIdentity() method; again, in order to maintain thread-safety, calling either will require a
-lock(DataStorageLock) { ... } statement.
+The base has a QueryData() method you can call; you can either pass in a QueryDefinition object or linq for a where predicate and/or linq for an order predicate and/or bool for ascending/descending order. If for some reason, you need direct access to the list, it can be accessed with the DataStorage property but it will require a lock(DataStorageLock) { ... } statement in order to maintain thread-safety. If for some reason, the CreateAsync() method needs to be overridden, to access the identity, use the Identity property and to increment the identity use the IncrementIdentity() method; again, in order to maintain thread-safety, calling either will require a lock(DataStorageLock) { ... } statement.
#### How to Override Base Functionality in Your Memory Storage Data Layer
Let's also say you need to do something extra in the CreateAsync() method. It's easy because the methods are virtual so you can override them.
@@ -326,8 +312,7 @@ public class AccountDataLayer : StandardCRUDDataLayer, IAccountDataLaye
**First, let's start off by saying the HTTP data layer is tightly coupled with the web API controllers defined in the JMayer.Web.Mvc library. If you're not using the JMayer.Web.Mvc library then your web API controllers will need to match the expected HTTP request and response defined here.**
#### How to Create Your HTTP Data Layer
-Going back to our banking account example, your application needs a way to interact with the account data so you need to define an interface for your account data layer and an account data layer sub class which inherits from StandardCRUDDataLayer in the JMayer.Data.HTTP.DataLayer namespace. Optionally, the data layer would need to be
-registered to the middleware in the Program.cs; this allows for depedency injection if your application utilizes it.
+Going back to our banking account example, your application needs a way to interact with the account data so you need to define an interface for your account data layer and an account data layer sub class which inherits from StandardCRUDDataLayer in the JMayer.Data.HTTP.DataLayer namespace. Optionally, the data layer would need to be registered to the middleware in the Program.cs; this allows for depedency injection if your application utilizes it.
```
public interface IAccountDataLayer : IStandardCRUDDataLayer
{
@@ -414,10 +399,8 @@ var accounts = await accountDataLayer.GetAllAsync();
var accountListViews = await accountDataLayer.GetAllListViewAsync();
```
This will send a GET HTTP request to the web API. The Uri will be formatted as {BaseAddress}/api/{TypeName}/All or {BaseAddress}/api/{TypeName}/All/ListView and the TypeName would be Account in our example.
-
-
-The StandardSubCRUDDataLayer has a GetAllAsync() and GetAllListViewAsync() method which accepts an owner ID; the idea is the web API returns all sub data objects under an owner. The Uri will be formatted as {BaseAddress}/api/{TypeName}/All/{OwnerInteger64ID} or {BaseAddress}/api/{TypeName}/All/{OwnerStringID} or
-{BaseAddress}/api/{TypeName}/All/ListView/{OwnerInteger64ID} or {BaseAddress}/api/{TypeName}/All/ListView/{OwnerStringID}.
+
+The StandardSubCRUDDataLayer has a GetAllAsync() and GetAllListViewAsync() method which accepts an owner ID; the idea is the web API returns all sub data objects under an owner. The Uri will be formatted as {BaseAddress}/api/{TypeName}/All/{OwnerInteger64ID} or {BaseAddress}/api/{TypeName}/All/{OwnerStringID} or {BaseAddress}/api/{TypeName}/All/ListView/{OwnerInteger64ID} or {BaseAddress}/api/{TypeName}/All/ListView/{OwnerStringID}.
#### How to Get Paged Data Objects Using Your HTTP Data Layer
```
@@ -503,13 +486,9 @@ QueryDefinition queryDefinition = new()
};
PagedList pagedList = accountDataLayer.GetPageListViewAsync(queryDefinition);
```
-This will send a GET HTTP request to the web API. The Uri will be formatted as {BaseAddress}/api/{TypeName}/Page?{queryDefinition} or {BaseAddress}/api/{TypeName}/Page/ListView?{queryDefinition} and the TypeName would be Account in our example. The query definition will be in the query string of the Uri and it'll be formatted as
-
-Skip={Skip}&Take={Take}&FilterDefinition[X].FilterOn={FilterOn}&FilterDefinition[X].Operator={Operator}&FilterDefinition[X].Value={Value}&SortDefinition[X].SortOn={SortOn}&SortDefinition[X].Descending={Descending}. X will be 0 to N; based on the number FilterDefinitions or SortDefinitions in each list.
-
-
-The StandardSubCRUDDataLayer has a GetPageAsync() and GetPageListViewAsync() method which accepts an owner ID; the idea is the web API returns all sub data objects under an owner. The Uri will be formatted as {BaseAddress}/api/{TypeName}/Page/{OwnerInteger64ID}?{queryDefinition} or {BaseAddress}/api/{TypeName}/Page/{OwnerStringID}?{queryDefinition}
-or {BaseAddress}/api/{TypeName}/Page/ListView/{OwnerInteger64ID}?{queryDefinition} or {BaseAddress}/api/{TypeName}/Page/ListView/{OwnerStringID}?{queryDefinition}.
+This will send a GET HTTP request to the web API. The Uri will be formatted as {BaseAddress}/api/{TypeName}/Page?{queryDefinition} or {BaseAddress}/api/{TypeName}/Page/ListView?{queryDefinition} and the TypeName would be Account in our example. The query definition will be in the query string of the Uri and it'll be formatted as Skip={Skip}&Take={Take}&FilterDefinition[X].FilterOn={FilterOn}&FilterDefinition[X].Operator={Operator}&FilterDefinition[X].Value={Value}&SortDefinition[X].SortOn={SortOn}&SortDefinition[X].Descending={Descending}. X will be 0 to N; based on the number FilterDefinitions or SortDefinitions in each list.
+
+The StandardSubCRUDDataLayer has a GetPageAsync() and GetPageListViewAsync() method which accepts an owner ID; the idea is the web API returns all sub data objects under an owner. The Uri will be formatted as {BaseAddress}/api/{TypeName}/Page/{OwnerInteger64ID}?{queryDefinition} or {BaseAddress}/api/{TypeName}/Page/{OwnerStringID}?{queryDefinition} or {BaseAddress}/api/{TypeName}/Page/ListView/{OwnerInteger64ID}?{queryDefinition} or {BaseAddress}/api/{TypeName}/Page/ListView/{OwnerStringID}?{queryDefinition}.
#### How to Get a Single Data Object Using Your HTTP Data Layer
```
@@ -582,39 +561,20 @@ public class AccountDataLayer : StandardCRUDDataLayer, IAccountDataLaye
The same can be done when using the StandardSubCRUDDataLayer.
### Build Your Own
-In the real world, your application will need to interact with an actual database instead of the memory storage classes provided and currently, the JMayer library suite doesn't provide data layer classes for accessing the various databases in existence. It's also possible the HTTP data layer is too restrictive or it needs to interact with something other
-than a Web API. Either way, you can build your own.
-
-
+In the real world, your application will need to interact with an actual database instead of the memory storage classes provided and currently, the JMayer library suite doesn't provide data layer classes for accessing the various databases in existence. It's also possible the HTTP data layer is too restrictive or it needs to interact with something other than a Web API. Either way, you can build your own.
+
You'll need to create a data layer class for X and implement at least the IStandardCRUDDataLayer interface. Then, its about using the necessary library to communicate with the database or remote server and filling out the interface methods with functionality.
-
-
+
Things to be aware of on the database side:
* Expressions. Your database library will need a linq to database translator.
* Property Mappings. Your database library may need to know if Column A in Table 1 is mapped to Property A in Data Object 1.
-# v9.0.0 Change Log
+# v9.1.0 Change Log
---
-* Updated to .NET9.
-* **Breaking Change:** Merged the UserEditableDataObject into the DataObject.
-* **Breaking Change:** Renamed the SubUserEditableDataObject to the SubDataObject.
-* **Breaking Change:** Merged the database IUserEditableDataLayer into the IStandardCRUDDataLayer.
-* **Breaking Change:** Merged the memory storage UserEditableDataLayer into the StandardCRUDDataLayer.
-* **Breaking Change:** Renamed the ISubUserEditableDataLayer to the IStandardSubCRUDDataLayer.
-* Created a memory storage StandardSubCRUDDataLayer.
-* **Breaking Change:** Changed memory storage StandardCRUDDataLayer.IsOldDataObjectDetectionEnabled property to be false by default; the developer should decide what features are turned on.
-* **Breaking Change:** Removed IsLessPreciseTimestampComparisonEnabled property from the database IStandardCRUDDataLayer and memory storage StandardCRUDDataLayer. Conflict detection will compare to the seconds; lower than that seems like overkill.
-* Added IsUniqueNameRequired property to the database IStandardCRUDDataLayer and memory storage StandardCRUDDataLayer. Before unique names would always be enforced; now its up to the developer.
-* **Breaking Change** Renamed the database IDNotFoundException to the DataObjectIDNotFoundException; the other data object related exceptions start with DataObject so this should too.
-* **Breaking Change:** Merged the HTTP IUserEditableDataLayer into the IStandardCRUDDataLayer.
-* **Breaking Change:** Merged the HTTP UserEditableDataLayer into the StandardCRUDDataLayer.
-* **Breaking Change:** Renamed the HTTP ISubUserEditableDataLayer to the IStandardSubCRUDDataLayer.
-* **Breaking Change:** Renamed the HTTP SubUserEditableDataLayer to the StandardSubCRUDDataLayer.
-* **Breaking Change:** Removed HTTP ServerSideValidationResult and ServerSideValidationError; it's expected the server will return a ValidationProblemDetails when validation issues occur.
-* **Breaking Change:** Renamed HTTP OperationResult.ServerSideValidationResult property to the ValidationErrors property. Type has changed too; its now a dictionary.
-* Added ProblemDetails property to the OperationResult. When the server returns a conflict (409), not found (404) or internal server error (500), the HTTP data layer will attempt to serialize the body as a ProblemDetails and the details will be set to OperationResult.ProblemDetails.
-* **Breaking Change:** Removed HTTP IStandardCRUDDataLayer.ValidateAsync().
+* Added a CompareToOtherMember data annotation attribute. You can compare two public members of the same class & instance and pass/fail validation based on the comparison rule you setup.
+* Added a RequiredDependsOn data annotation attribute. A public member will have the Required data annotation evaulated if another public member of the same class & instance equals a boolean value or enum value.
---
+* [ASP.NET Core MVC Example Project](https://github.com/jmayer913/JMayer-Example-ASPVanillaMVC)
* [ASP.NET Core MVC with Syncfusion Example Project](https://github.com/jmayer913/JMayer-Example-ASPSyncfusionMVC)
* [ASP.NET Core / React Example Project](https://github.com/jmayer913/JMayer-Example-ASPReact)
* [Blazor WebAssembly Example Project](https://github.com/jmayer913/JMayer-Example-WebAssemblyBlazor)
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..7076363
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberEqual.cs
@@ -0,0 +1,18 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Bool;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two bool properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public bool Property1 { get; set; }
+
+ ///
+ ///
+ ///
+ public bool Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..01b309e
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Bool;
+
+///
+/// The class is used to test the greater than comparison operator is not suppored for the CompareToOtherMember attribute.
+///
+public class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public bool Property1 { get; set; }
+
+ public bool Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..95e2eb2
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Bool;
+
+///
+/// The class is used to test the greater than or equal comparison operator is not suppored for the CompareToOtherMember attribute.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public bool Property1 { get; set; }
+
+ public bool Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..ed0fc9d
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Bool;
+
+///
+/// The class is used to test the less than comparison operator is not suppored for the CompareToOtherMember attribute.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public bool Property1 { get; set; }
+
+ public bool Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..908466d
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Bool;
+
+///
+/// The class is used to test the less than or equal comparison operator is not suppored for the CompareToOtherMember attribute.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public bool Property1 { get; set; }
+
+ public bool Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..7865f81
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Bool/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,18 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Bool;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two bool properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public bool Property1 { get; set; }
+
+ ///
+ ///
+ ///
+ public bool Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..8da7647
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Byte;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public byte Property1 { get; set; }
+
+ public byte Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..c6aaa94
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Byte;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public byte Property1 { get; set; }
+
+ public byte Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..196ccc3
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Byte;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public byte Property1 { get; set; }
+
+ public byte Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..de4bd19
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Byte;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public byte Property1 { get; set; }
+
+ public byte Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..3db94ad
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Byte;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public byte Property1 { get; set; }
+
+ public byte Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..78849af
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Byte/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Byte;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public byte Property1 { get; set; }
+
+ public byte Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..ef2ad35
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberEqual.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Char;
+
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public char Property1 { get; set; }
+
+ public char Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..de2eeb3
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Char;
+
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public char Property1 { get; set; }
+
+ public char Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..e1ffecd
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Char;
+
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public char Property1 { get; set; }
+
+ public char Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..c8f5cd6
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Char;
+
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public char Property1 { get; set; }
+
+ public char Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..8649d19
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Char;
+
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public char Property1 { get; set; }
+
+ public char Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..929814d
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Char/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Char;
+
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public char Property1 { get; set; }
+
+ public char Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareOtherMemberFailOtherMemberIfNull.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareOtherMemberFailOtherMemberIfNull.cs
new file mode 100644
index 0000000..b32635e
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareOtherMemberFailOtherMemberIfNull.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers;
+
+internal class CompareOtherMemberFailOtherMemberIfNull : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public string? Property1 { get; set; }
+
+ public string? Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareOtherMemberFailRegisteredMemberIfNull.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareOtherMemberFailRegisteredMemberIfNull.cs
new file mode 100644
index 0000000..b77541e
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareOtherMemberFailRegisteredMemberIfNull.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers;
+
+internal class CompareOtherMemberFailRegisteredMemberIfNull : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public string? Property1 { get; set; }
+
+ public string? Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareOtherMemberPassOtherMemberIfNull.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareOtherMemberPassOtherMemberIfNull.cs
new file mode 100644
index 0000000..1eb3b2a
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareOtherMemberPassOtherMemberIfNull.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers;
+
+internal class CompareOtherMemberPassOtherMemberIfNull : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal, passOtherMemberIfNull: true)]
+ public string? Property1 { get; set; }
+
+ public string? Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareOtherMemberPassRegisteredMemberIfNull.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareOtherMemberPassRegisteredMemberIfNull.cs
new file mode 100644
index 0000000..547d393
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareOtherMemberPassRegisteredMemberIfNull.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers;
+
+internal class CompareOtherMemberPassRegisteredMemberIfNull : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal, passRegisteredMemberIfNull: true)]
+ public string? Property1 { get; set; }
+
+ public string? Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareToOtherMemberInvalidType.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareToOtherMemberInvalidType.cs
new file mode 100644
index 0000000..35ea821
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareToOtherMemberInvalidType.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when the type is invalid.
+///
+internal class CompareToOtherMemberInvalidType : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public object Property1 { get; set; } = new();
+
+ public object Property2 { get; set; } = new();
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareToOtherMemberNotFound.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareToOtherMemberNotFound.cs
new file mode 100644
index 0000000..5be6914
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareToOtherMemberNotFound.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when the member is not found.
+///
+internal class CompareToOtherMemberNotFound : DataObject
+{
+ [CompareToOtherMember("MemberNotFound", ComparisonOperation.Equal)]
+ public bool Property1 { get; set; }
+
+ public bool Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareToOtherMemberSameMember.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareToOtherMemberSameMember.cs
new file mode 100644
index 0000000..63a3ee0
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareToOtherMemberSameMember.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when the same member is used.
+///
+internal class CompareToOtherMemberSameMember : DataObject
+{
+ [CompareToOtherMember(nameof(Property1), ComparisonOperation.Equal)]
+ public bool Property1 { get; set; }
+
+ public bool Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareToOtherMemberTypeMismatch.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareToOtherMemberTypeMismatch.cs
new file mode 100644
index 0000000..d616786
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/CompareToOtherMemberTypeMismatch.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when there is a type mismatch.
+///
+internal class CompareToOtherMemberTypeMismatch : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public bool Property1 { get; set; } = new();
+
+ public int Property2 { get; set; } = new();
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..ca90617
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateOnly;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public System.DateOnly Property1 { get; set; }
+
+ public System.DateOnly Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..5be7ee5
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateOnly;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public System.DateOnly Property1 { get; set; }
+
+ public System.DateOnly Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..e525869
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateOnly;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public System.DateOnly Property1 { get; set; }
+
+ public System.DateOnly Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..c1d2958
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateOnly;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public System.DateOnly Property1 { get; set; }
+
+ public System.DateOnly Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..a852946
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateOnly;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public System.DateOnly Property1 { get; set; }
+
+ public System.DateOnly Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..7a68db5
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateOnly/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateOnly;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public System.DateOnly Property1 { get; set; }
+
+ public System.DateOnly Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..ed8afce
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTime;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public System.DateTime Property1 { get; set; }
+
+ public System.DateTime Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..f84b9a0
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTime;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public System.DateTime Property1 { get; set; }
+
+ public System.DateTime Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..7aef591
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTime;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public System.DateTime Property1 { get; set; }
+
+ public System.DateTime Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..4aa9daa
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTime;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public System.DateTime Property1 { get; set; }
+
+ public System.DateTime Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..48725c1
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTime;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public System.DateTime Property1 { get; set; }
+
+ public System.DateTime Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..ac5cbe6
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTime/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTime;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public System.DateTime Property1 { get; set; }
+
+ public System.DateTime Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..86a8c93
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTimeOffset;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public System.DateTimeOffset Property1 { get; set; }
+
+ public System.DateTimeOffset Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..db26af3
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTimeOffset;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public System.DateTimeOffset Property1 { get; set; }
+
+ public System.DateTimeOffset Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..db97a5e
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTimeOffset;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public System.DateTimeOffset Property1 { get; set; }
+
+ public System.DateTimeOffset Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..849e804
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTimeOffset;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public System.DateTimeOffset Property1 { get; set; }
+
+ public System.DateTimeOffset Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..46c57f0
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTimeOffset;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public System.DateTimeOffset Property1 { get; set; }
+
+ public System.DateTimeOffset Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..2bf5cad
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/DateTimeOffset/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTimeOffset;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public System.DateTimeOffset Property1 { get; set; }
+
+ public System.DateTimeOffset Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..fe5f3e8
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Decimal;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public decimal Property1 { get; set; }
+
+ public decimal Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..cf67965
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Decimal;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public decimal Property1 { get; set; }
+
+ public decimal Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..60dbce6
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Decimal;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public decimal Property1 { get; set; }
+
+ public decimal Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..4e29f57
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Decimal;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public decimal Property1 { get; set; }
+
+ public decimal Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..f24b98e
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Decimal;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public decimal Property1 { get; set; }
+
+ public decimal Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..e6dbf2b
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Decimal/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Decimal;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public decimal Property1 { get; set; }
+
+ public decimal Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..dbb6e26
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Double;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public double Property1 { get; set; }
+
+ public double Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..86787ca
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Double;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public double Property1 { get; set; }
+
+ public double Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..00173b4
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Double;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public double Property1 { get; set; }
+
+ public double Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..044c8f3
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Double;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public double Property1 { get; set; }
+
+ public double Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..17cfdd8
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Double;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public double Property1 { get; set; }
+
+ public double Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..f59d8bd
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Double/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Double;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public double Property1 { get; set; }
+
+ public double Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..ff2a5e9
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberEqual.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Enum;
+
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public TestEnum Property1 { get; set; }
+
+ public TestEnum Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..7fbff3f
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Enum;
+
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public TestEnum Property1 { get; set; }
+
+ public TestEnum Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..e245466
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Enum;
+
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public TestEnum Property1 { get; set; }
+
+ public TestEnum Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..e042b27
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Enum;
+
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public TestEnum Property1 { get; set; }
+
+ public TestEnum Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..cab8b8f
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Enum;
+
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public TestEnum Property1 { get; set; }
+
+ public TestEnum Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..cddf2cc
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Enum;
+
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public TestEnum Property1 { get; set; }
+
+ public TestEnum Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberTypeMismatch.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberTypeMismatch.cs
new file mode 100644
index 0000000..dcddf46
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/CompareToOtherMemberTypeMismatch.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Enum;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when the type is invalid.
+///
+internal class CompareToOtherMemberTypeMismatch : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public TestEnum Property1 { get; set; } = new();
+
+ public ConditionalEnum Property2 { get; set; } = new();
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/TestEnum.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/TestEnum.cs
new file mode 100644
index 0000000..726b66d
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Enum/TestEnum.cs
@@ -0,0 +1,10 @@
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Enum;
+
+///
+/// An enumeration used by the CompareToOtherMember tests.
+///
+internal enum TestEnum
+{
+ Value1,
+ Value2
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..c623223
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Float;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public float Property1 { get; set; }
+
+ public float Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..a42a423
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Float;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public float Property1 { get; set; }
+
+ public float Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..bf27561
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Float;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public float Property1 { get; set; }
+
+ public float Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..15336a6
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Float;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public float Property1 { get; set; }
+
+ public float Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..0d6b1fa
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Float;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public float Property1 { get; set; }
+
+ public float Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..00552c5
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Float/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Float;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public float Property1 { get; set; }
+
+ public float Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..fe95e4b
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Int;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public int Property1 { get; set; }
+
+ public int Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..b50d67b
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Int;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public int Property1 { get; set; }
+
+ public int Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..1960902
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Int;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public int Property1 { get; set; }
+
+ public int Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..b67681d
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Int;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public int Property1 { get; set; }
+
+ public int Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..cbe5f6d
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Int;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public int Property1 { get; set; }
+
+ public int Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..7865ebd
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Int/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Int;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public int Property1 { get; set; }
+
+ public int Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..845c1a6
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Long;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public long Property1 { get; set; }
+
+ public long Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..5655a85
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Long;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public long Property1 { get; set; }
+
+ public long Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..d2c075a
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Long;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public long Property1 { get; set; }
+
+ public long Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..9db1f2f
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Long;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public long Property1 { get; set; }
+
+ public long Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..4dbd42c
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Long;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public long Property1 { get; set; }
+
+ public long Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..7964a9f
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Long/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Long;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public long Property1 { get; set; }
+
+ public long Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..aa3e9fd
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Sbyte;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public sbyte Property1 { get; set; }
+
+ public sbyte Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..e72ff2c
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Sbyte;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public sbyte Property1 { get; set; }
+
+ public sbyte Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..62030d1
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Sbyte;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public sbyte Property1 { get; set; }
+
+ public sbyte Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..7a021c6
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Sbyte;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public sbyte Property1 { get; set; }
+
+ public sbyte Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..681a7c5
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Sbyte;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public sbyte Property1 { get; set; }
+
+ public sbyte Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..9614de5
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Sbyte/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Sbyte;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public sbyte Property1 { get; set; }
+
+ public sbyte Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..a341e40
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Short;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public short Property1 { get; set; }
+
+ public short Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..999a56a
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Short;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public short Property1 { get; set; }
+
+ public short Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..0bf3ded
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Short;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public short Property1 { get; set; }
+
+ public short Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..197a109
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Short;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public short Property1 { get; set; }
+
+ public short Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..dd2bd2b
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Short;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public short Property1 { get; set; }
+
+ public short Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..d6ae303
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Short/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Short;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public short Property1 { get; set; }
+
+ public short Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..e8809ba
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberEqual.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.String;
+
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public string? Property1 { get; set; }
+
+ public string? Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..90f0b4e
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.String;
+
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public string? Property1 { get; set; }
+
+ public string? Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..c1674d4
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.String;
+
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public string? Property1 { get; set; }
+
+ public string? Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..97c9db0
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.String;
+
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public string? Property1 { get; set; }
+
+ public string? Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..0e79517
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.String;
+
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public string? Property1 { get; set; }
+
+ public string? Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..4d35930
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/String/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,12 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.String;
+
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public string? Property1 { get; set; }
+
+ public string? Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..9ae253c
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeOnly;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public System.TimeOnly Property1 { get; set; }
+
+ public System.TimeOnly Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..cf9aa2f
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeOnly;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public System.TimeOnly Property1 { get; set; }
+
+ public System.TimeOnly Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..09744bb
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeOnly;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public System.TimeOnly Property1 { get; set; }
+
+ public System.TimeOnly Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..461e999
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeOnly;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public System.TimeOnly Property1 { get; set; }
+
+ public System.TimeOnly Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..10d07b2
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeOnly;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public System.TimeOnly Property1 { get; set; }
+
+ public System.TimeOnly Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..0313a99
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeOnly/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeOnly;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public System.TimeOnly Property1 { get; set; }
+
+ public System.TimeOnly Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..9fb074f
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeSpan;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public System.TimeSpan Property1 { get; set; }
+
+ public System.TimeSpan Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..3ee9210
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeSpan;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public System.TimeSpan Property1 { get; set; }
+
+ public System.TimeSpan Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..9bbfcdd
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeSpan;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public System.TimeSpan Property1 { get; set; }
+
+ public System.TimeSpan Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..28724de
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeSpan;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public System.TimeSpan Property1 { get; set; }
+
+ public System.TimeSpan Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..0954485
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeSpan;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public System.TimeSpan Property1 { get; set; }
+
+ public System.TimeSpan Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..6052555
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/TimeSpan/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeSpan;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public System.TimeSpan Property1 { get; set; }
+
+ public System.TimeSpan Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..4b63860
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Uint;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public uint Property1 { get; set; }
+
+ public uint Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..0917c33
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Uint;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public uint Property1 { get; set; }
+
+ public uint Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..faa0f9c
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Uint;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public uint Property1 { get; set; }
+
+ public uint Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..f5b5c4e
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Uint;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public uint Property1 { get; set; }
+
+ public uint Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..3749c99
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Uint;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public uint Property1 { get; set; }
+
+ public uint Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..7da7bb7
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Uint/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Uint;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public uint Property1 { get; set; }
+
+ public uint Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..e087b7b
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Ulong;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public ulong Property1 { get; set; }
+
+ public ulong Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..aa8f8f5
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Ulong;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public ulong Property1 { get; set; }
+
+ public ulong Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..fb70e70
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Ulong;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public ulong Property1 { get; set; }
+
+ public ulong Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..3471a20
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Ulong;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public ulong Property1 { get; set; }
+
+ public ulong Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..35d55bf
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Ulong;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public ulong Property1 { get; set; }
+
+ public ulong Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..7430344
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ulong/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Ulong;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public ulong Property1 { get; set; }
+
+ public ulong Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberEqual.cs
new file mode 100644
index 0000000..09fb9fe
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Ushort;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be equal.
+///
+internal class CompareToOtherMemberEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.Equal)]
+ public ushort Property1 { get; set; }
+
+ public ushort Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberGreaterThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberGreaterThan.cs
new file mode 100644
index 0000000..60ccc34
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberGreaterThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Ushort;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than property 2.
+///
+internal class CompareToOtherMemberGreaterThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThan)]
+ public ushort Property1 { get; set; }
+
+ public ushort Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberGreaterThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberGreaterThanOrEqual.cs
new file mode 100644
index 0000000..d2a7e8f
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberGreaterThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Ushort;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be greater than or equal to property 2.
+///
+internal class CompareToOtherMemberGreaterThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.GreaterThanOrEqual)]
+ public ushort Property1 { get; set; }
+
+ public ushort Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberLessThan.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberLessThan.cs
new file mode 100644
index 0000000..adcd5a9
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberLessThan.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Ushort;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than property 2.
+///
+internal class CompareToOtherMemberLessThan : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThan)]
+ public ushort Property1 { get; set; }
+
+ public ushort Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberLessThanOrEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberLessThanOrEqual.cs
new file mode 100644
index 0000000..a1e4943
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberLessThanOrEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Ushort;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing property 1 to be less than or equal to property 2.
+///
+internal class CompareToOtherMemberLessThanOrEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.LessThanOrEqual)]
+ public ushort Property1 { get; set; }
+
+ public ushort Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberNotEqual.cs b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberNotEqual.cs
new file mode 100644
index 0000000..c3f66d9
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/CompareToOtherMembers/Ushort/CompareToOtherMemberNotEqual.cs
@@ -0,0 +1,15 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations.CompareToOtherMembers.Ushort;
+
+///
+/// The class is used to test the CompareToOtherMember attribute when comparing two byte properties to be not equal.
+///
+internal class CompareToOtherMemberNotEqual : DataObject
+{
+ [CompareToOtherMember(nameof(Property2), ComparisonOperation.NotEqual)]
+ public ushort Property1 { get; set; }
+
+ public ushort Property2 { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/ConditionalEnum.cs b/TestProject/Data/DataAnnotations/ConditionalEnum.cs
new file mode 100644
index 0000000..8e0b07f
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/ConditionalEnum.cs
@@ -0,0 +1,10 @@
+namespace TestProject.Data.DataAnnotations;
+
+///
+/// An enumeration used by the RequiredDependsOn tests.
+///
+internal enum ConditionalEnum
+{
+ Condition1,
+ Condition2,
+}
diff --git a/TestProject/Data/DataAnnotations/RequiredDependsOnEnum.cs b/TestProject/Data/DataAnnotations/RequiredDependsOnEnum.cs
new file mode 100644
index 0000000..62eec00
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/RequiredDependsOnEnum.cs
@@ -0,0 +1,21 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations;
+
+///
+/// The class is used to test the RequiredDependsOn attribute when the condition is for a enum value.
+///
+internal class RequiredDependsOnEnum : DataObject
+{
+ ///
+ /// The property gets/sets the string value evaluated by the RequiredDependsOn attribute.
+ ///
+ [RequiredDependsOn(dependentMemberName: nameof(DependentOnMember), conditionValue: ConditionalEnum.Condition2)]
+ public string ConditionalRequireValue { get; set; } = string.Empty;
+
+ ///
+ /// The property gets/sets the enum value the ConditionalRequire property is dependent on.
+ ///
+ public ConditionalEnum DependentOnMember { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/RequiredDependsOnFalse.cs b/TestProject/Data/DataAnnotations/RequiredDependsOnFalse.cs
new file mode 100644
index 0000000..052df62
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/RequiredDependsOnFalse.cs
@@ -0,0 +1,21 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations;
+
+///
+/// The class is used to test the RequiredDependsOn attribute when the condition is false.
+///
+internal class RequiredDependsOnFalse : DataObject
+{
+ ///
+ /// The property gets/sets the string value evaluated by the RequiredDependsOn attribute.
+ ///
+ [RequiredDependsOn(dependentMemberName: nameof(DependentOnMember), conditionValue: false)]
+ public string ConditionalRequireValue { get; set; } = string.Empty;
+
+ ///
+ /// The property gets/sets the boolean value the ConditionalRequire property is dependent on.
+ ///
+ public bool DependentOnMember { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/RequiredDependsOnInvalidType.cs b/TestProject/Data/DataAnnotations/RequiredDependsOnInvalidType.cs
new file mode 100644
index 0000000..c3dd3ce
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/RequiredDependsOnInvalidType.cs
@@ -0,0 +1,21 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations;
+
+///
+/// The class is used to test the RequiredDependsOn attribute when the types are invalid.
+///
+internal class RequiredDependsOnInvalidType : DataObject
+{
+ ///
+ /// The property gets/sets the string value evaluated by the RequiredDependsOn attribute.
+ ///
+ [RequiredDependsOn(dependentMemberName: nameof(DependentOnMember), conditionValue: 0)]
+ public int ConditionalRequireValue { get; set; }
+
+ ///
+ /// The property gets/sets the boolean value the ConditionalRequire property is dependent on.
+ ///
+ public int DependentOnMember { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/RequiredDependsOnMemberNotFound.cs b/TestProject/Data/DataAnnotations/RequiredDependsOnMemberNotFound.cs
new file mode 100644
index 0000000..b9a3588
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/RequiredDependsOnMemberNotFound.cs
@@ -0,0 +1,21 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations;
+
+///
+/// The class is used to test the RequiredDependsOn attribute when the member is not found.
+///
+internal class RequiredDependsOnMemberNotFound : DataObject
+{
+ ///
+ /// The property gets/sets the string value evaluated by the RequiredDependsOn attribute.
+ ///
+ [RequiredDependsOn(dependentMemberName: "NotFoundMember", conditionValue: true)]
+ public string ConditionalRequireValue { get; set; } = string.Empty;
+
+ ///
+ /// The property gets/sets the boolean value the ConditionalRequire property is dependent on.
+ ///
+ public bool DependentOnMember { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/RequiredDependsOnSameMemeber.cs b/TestProject/Data/DataAnnotations/RequiredDependsOnSameMemeber.cs
new file mode 100644
index 0000000..bc8bcfe
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/RequiredDependsOnSameMemeber.cs
@@ -0,0 +1,21 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations;
+
+///
+/// The class is used to test the RequiredDependsOn attribute when the same member is used.
+///
+internal class RequiredDependsOnSameMemeber : DataObject
+{
+ ///
+ /// The property gets/sets the string value evaluated by the RequiredDependsOn attribute.
+ ///
+ [RequiredDependsOn(dependentMemberName: nameof(ConditionalRequireValue), conditionValue: true)]
+ public string ConditionalRequireValue { get; set; } = string.Empty;
+
+ ///
+ /// The property gets/sets the boolean value the ConditionalRequire property is dependent on.
+ ///
+ public bool DependentOnMember { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/RequiredDependsOnTrue.cs b/TestProject/Data/DataAnnotations/RequiredDependsOnTrue.cs
new file mode 100644
index 0000000..624dac4
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/RequiredDependsOnTrue.cs
@@ -0,0 +1,21 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations;
+
+///
+/// The class is used to test the RequiredDependsOn attribute when the condition is true.
+///
+internal class RequiredDependsOnTrue : DataObject
+{
+ ///
+ /// The property gets/sets the string value evaluated by the RequiredDependsOn attribute.
+ ///
+ [RequiredDependsOn(dependentMemberName: nameof(DependentOnMember), conditionValue: true)]
+ public string ConditionalRequireValue { get; set; } = string.Empty;
+
+ ///
+ /// The property gets/sets the boolean value the ConditionalRequire property is dependent on.
+ ///
+ public bool DependentOnMember { get; set; }
+}
diff --git a/TestProject/Data/DataAnnotations/RequiredDependsOnTypeMismatch.cs b/TestProject/Data/DataAnnotations/RequiredDependsOnTypeMismatch.cs
new file mode 100644
index 0000000..c244186
--- /dev/null
+++ b/TestProject/Data/DataAnnotations/RequiredDependsOnTypeMismatch.cs
@@ -0,0 +1,21 @@
+using JMayer.Data.Data;
+using JMayer.Data.DataAnnotations;
+
+namespace TestProject.Data.DataAnnotations;
+
+///
+/// The class is used to test the RequiredDependsOn attribute when there is a type mismatch between the conditionValue and dependent on member.
+///
+internal class RequiredDependsOnTypeMismatch : DataObject
+{
+ ///
+ /// The property gets/sets the string value evaluated by the RequiredDependsOn attribute.
+ ///
+ [RequiredDependsOn(dependentMemberName: nameof(DependentOnMember), conditionValue: ConditionalEnum.Condition1)]
+ public string ConditionalRequireValue { get; set; } = string.Empty;
+
+ ///
+ /// The property gets/sets the boolean value the ConditionalRequire property is dependent on.
+ ///
+ public bool DependentOnMember { get; set; }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberBoolUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberBoolUnitTest.cs
new file mode 100644
index 0000000..09dac58
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberBoolUnitTest.cs
@@ -0,0 +1,163 @@
+using JMayer.Data.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Bool;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the bool data type.
+///
+public class CompareToOtherMemberBoolUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two bool properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = true,
+ Property2 = false,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = false;
+ dataObject.Property2 = true;
+
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two bool properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = true,
+ Property2 = true,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = false;
+ dataObject.Property2 = false;
+
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two bool properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = true,
+ Property2 = true,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = false;
+ dataObject.Property2 = false;
+
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two bool properties don't equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = true,
+ Property2 = false,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = false;
+ dataObject.Property2 = true;
+
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is greater than.
+ ///
+ [Fact]
+ public void VerifyFailureGreaterThanNotSupported()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForBoolErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is greater than or equal.
+ ///
+ [Fact]
+ public void VerifyFailureGreaterThanOrEqualNotSupported()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForBoolErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is less than.
+ ///
+ [Fact]
+ public void VerifyFailureLessThanNotSupported()
+ {
+ CompareToOtherMemberLessThan dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForBoolErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is less than or equal.
+ ///
+ [Fact]
+ public void VerifyFailureLessThanOrEqualNotSupported()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForBoolErrorMessage, validationResults[0].ErrorMessage);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberByteUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberByteUnitTest.cs
new file mode 100644
index 0000000..833a7ac
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberByteUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Byte;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the byte data type.
+///
+public class CompareToOtherMemberByteUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = byte.MaxValue,
+ Property2 = byte.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = byte.MinValue;
+ dataObject.Property2 = byte.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = byte.MaxValue,
+ Property2 = byte.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = byte.MinValue;
+ dataObject.Property2 = byte.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = byte.MinValue,
+ Property2 = byte.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = byte.MaxValue,
+ Property2 = byte.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = byte.MinValue,
+ Property2 = byte.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = byte.MaxValue,
+ Property2 = byte.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = byte.MaxValue;
+ dataObject.Property2 = byte.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = byte.MaxValue,
+ Property2 = byte.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = byte.MinValue,
+ Property2 = byte.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = byte.MaxValue,
+ Property2 = byte.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = byte.MinValue,
+ Property2 = byte.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = byte.MaxValue;
+ dataObject.Property2 = byte.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = byte.MaxValue,
+ Property2 = byte.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = byte.MinValue;
+ dataObject.Property2 = byte.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = byte.MaxValue,
+ Property2 = byte.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = byte.MinValue;
+ dataObject.Property2 = byte.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberCharUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberCharUnitTest.cs
new file mode 100644
index 0000000..7ebe5a8
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberCharUnitTest.cs
@@ -0,0 +1,179 @@
+using JMayer.Data.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Char;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the char data type.
+///
+public class CompareToOtherMemberCharUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = char.MinValue,
+ Property2 = char.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = char.MaxValue;
+ dataObject.Property2 = char.MinValue;
+
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = char.MinValue,
+ Property2 = char.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = char.MaxValue;
+ dataObject.Property2 = char.MaxValue;
+
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = char.MinValue,
+ Property2 = char.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = char.MaxValue;
+ dataObject.Property2 = char.MaxValue;
+
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties don't equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = char.MinValue,
+ Property2 = char.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = char.MaxValue;
+ dataObject.Property2 = char.MinValue;
+
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is greater than.
+ ///
+ [Fact]
+ public void VerifyFailureGreaterThanNotSupported()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = char.MinValue,
+ Property2 = char.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForCharErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is greater than or equal.
+ ///
+ [Fact]
+ public void VerifyFailureGreaterThanOrEqualNotSupported()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = char.MinValue,
+ Property2 = char.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForCharErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is less than.
+ ///
+ [Fact]
+ public void VerifyFailureLessThanNotSupported()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = char.MinValue,
+ Property2 = char.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForCharErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is less than or equal.
+ ///
+ [Fact]
+ public void VerifyFailureLessThanOrEqualNotSupported()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = char.MinValue,
+ Property2 = char.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForCharErrorMessage, validationResults[0].ErrorMessage);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberDateOnlyUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberDateOnlyUnitTest.cs
new file mode 100644
index 0000000..dd158d0
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberDateOnlyUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.DateOnly;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the DateOnly data type.
+///
+public class CompareToOtherMemberDateOnlyUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = System.DateOnly.MaxValue,
+ Property2 = System.DateOnly.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = System.DateOnly.MinValue;
+ dataObject.Property2 = System.DateOnly.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = System.DateOnly.MaxValue,
+ Property2 = System.DateOnly.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.DateOnly.MinValue;
+ dataObject.Property2 = System.DateOnly.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = System.DateOnly.MinValue,
+ Property2 = System.DateOnly.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = System.DateOnly.MaxValue,
+ Property2 = System.DateOnly.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = System.DateOnly.MinValue,
+ Property2 = System.DateOnly.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = System.DateOnly.MaxValue,
+ Property2 = System.DateOnly.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.DateOnly.MaxValue;
+ dataObject.Property2 = System.DateOnly.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = System.DateOnly.MaxValue,
+ Property2 = System.DateOnly.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = System.DateOnly.MinValue,
+ Property2 = System.DateOnly.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = System.DateOnly.MaxValue,
+ Property2 = System.DateOnly.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = System.DateOnly.MinValue,
+ Property2 = System.DateOnly.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.DateOnly.MaxValue;
+ dataObject.Property2 = System.DateOnly.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = System.DateOnly.MaxValue,
+ Property2 = System.DateOnly.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = System.DateOnly.MinValue;
+ dataObject.Property2 = System.DateOnly.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = System.DateOnly.MaxValue,
+ Property2 = System.DateOnly.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.DateOnly.MinValue;
+ dataObject.Property2 = System.DateOnly.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberDateTimeOffsetUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberDateTimeOffsetUnitTest.cs
new file mode 100644
index 0000000..8b40d24
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberDateTimeOffsetUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTimeOffset;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the DateTimeOffset data type.
+///
+public class CompareToOtherMemberDateTimeOffsetUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = System.DateTimeOffset.MaxValue,
+ Property2 = System.DateTimeOffset.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = System.DateTimeOffset.MinValue;
+ dataObject.Property2 = System.DateTimeOffset.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = System.DateTimeOffset.MaxValue,
+ Property2 = System.DateTimeOffset.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.DateTimeOffset.MinValue;
+ dataObject.Property2 = System.DateTimeOffset.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = System.DateTimeOffset.MinValue,
+ Property2 = System.DateTimeOffset.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = System.DateTimeOffset.MaxValue,
+ Property2 = System.DateTimeOffset.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = System.DateTimeOffset.MinValue,
+ Property2 = System.DateTimeOffset.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = System.DateTimeOffset.MaxValue,
+ Property2 = System.DateTimeOffset.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.DateTimeOffset.MaxValue;
+ dataObject.Property2 = System.DateTimeOffset.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = System.DateTimeOffset.MaxValue,
+ Property2 = System.DateTimeOffset.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = System.DateTimeOffset.MinValue,
+ Property2 = System.DateTimeOffset.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = System.DateTimeOffset.MaxValue,
+ Property2 = System.DateTimeOffset.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = System.DateTimeOffset.MinValue,
+ Property2 = System.DateTimeOffset.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.DateTimeOffset.MaxValue;
+ dataObject.Property2 = System.DateTimeOffset.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = System.DateTimeOffset.MaxValue,
+ Property2 = System.DateTimeOffset.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = System.DateTimeOffset.MinValue;
+ dataObject.Property2 = System.DateTimeOffset.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = System.DateTimeOffset.MaxValue,
+ Property2 = System.DateTimeOffset.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.DateTimeOffset.MinValue;
+ dataObject.Property2 = System.DateTimeOffset.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberDateTimeUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberDateTimeUnitTest.cs
new file mode 100644
index 0000000..a3f1459
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberDateTimeUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.DateTime;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the DateTime data type.
+///
+public class CompareToOtherMemberDateTimeUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = System.DateTime.MaxValue,
+ Property2 = System.DateTime.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = System.DateTime.MinValue;
+ dataObject.Property2 = System.DateTime.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = System.DateTime.MaxValue,
+ Property2 = System.DateTime.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.DateTime.MinValue;
+ dataObject.Property2 = System.DateTime.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = System.DateTime.MinValue,
+ Property2 = System.DateTime.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = System.DateTime.MaxValue,
+ Property2 = System.DateTime.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = System.DateTime.MinValue,
+ Property2 = System.DateTime.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = System.DateTime.MaxValue,
+ Property2 = System.DateTime.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.DateTime.MaxValue;
+ dataObject.Property2 = System.DateTime.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = System.DateTime.MaxValue,
+ Property2 = System.DateTime.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = System.DateTime.MinValue,
+ Property2 = System.DateTime.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = System.DateTime.MaxValue,
+ Property2 = System.DateTime.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = System.DateTime.MinValue,
+ Property2 = System.DateTime.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.DateTime.MaxValue;
+ dataObject.Property2 = System.DateTime.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = System.DateTime.MaxValue,
+ Property2 = System.DateTime.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = System.DateTime.MinValue;
+ dataObject.Property2 = System.DateTime.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = System.DateTime.MaxValue,
+ Property2 = System.DateTime.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.DateTime.MinValue;
+ dataObject.Property2 = System.DateTime.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberDecimalUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberDecimalUnitTest.cs
new file mode 100644
index 0000000..4fef481
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberDecimalUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Decimal;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the decimal data type.
+///
+public class CompareToOtherMemberDecimalUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = decimal.MaxValue,
+ Property2 = decimal.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = decimal.MinValue;
+ dataObject.Property2 = decimal.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = decimal.MaxValue,
+ Property2 = decimal.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = decimal.MinValue;
+ dataObject.Property2 = decimal.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = decimal.MinValue,
+ Property2 = decimal.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = decimal.MaxValue,
+ Property2 = decimal.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = decimal.MinValue,
+ Property2 = decimal.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = decimal.MaxValue,
+ Property2 = decimal.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = decimal.MaxValue;
+ dataObject.Property2 = decimal.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = decimal.MaxValue,
+ Property2 = decimal.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = decimal.MinValue,
+ Property2 = decimal.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = decimal.MaxValue,
+ Property2 = decimal.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = decimal.MinValue,
+ Property2 = decimal.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = decimal.MaxValue;
+ dataObject.Property2 = decimal.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = decimal.MaxValue,
+ Property2 = decimal.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = decimal.MinValue;
+ dataObject.Property2 = decimal.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = decimal.MaxValue,
+ Property2 = decimal.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = decimal.MinValue;
+ dataObject.Property2 = decimal.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberDoubleUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberDoubleUnitTest.cs
new file mode 100644
index 0000000..5b8573b
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberDoubleUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Double;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the double data type.
+///
+public class CompareToOtherMemberDoubleUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = double.MaxValue,
+ Property2 = double.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = double.MinValue;
+ dataObject.Property2 = double.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = double.MaxValue,
+ Property2 = double.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = double.MinValue;
+ dataObject.Property2 = double.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = double.MinValue,
+ Property2 = double.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = double.MaxValue,
+ Property2 = double.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = double.MinValue,
+ Property2 = double.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = double.MaxValue,
+ Property2 = double.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = double.MaxValue;
+ dataObject.Property2 = double.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = double.MaxValue,
+ Property2 = double.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = double.MinValue,
+ Property2 = double.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = double.MaxValue,
+ Property2 = double.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = double.MinValue,
+ Property2 = double.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = double.MaxValue;
+ dataObject.Property2 = double.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = double.MaxValue,
+ Property2 = double.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = double.MinValue;
+ dataObject.Property2 = double.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = double.MaxValue,
+ Property2 = double.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = double.MinValue;
+ dataObject.Property2 = double.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberEnumUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberEnumUnitTest.cs
new file mode 100644
index 0000000..b06ec42
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberEnumUnitTest.cs
@@ -0,0 +1,192 @@
+using JMayer.Data.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Enum;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the string data type.
+///
+public class CompareToOtherMemberEnumUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = TestEnum.Value1,
+ Property2 = TestEnum.Value2,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = TestEnum.Value2;
+ dataObject.Property2 = TestEnum.Value1;
+
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = TestEnum.Value1,
+ Property2 = TestEnum.Value1,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = TestEnum.Value2;
+ dataObject.Property2 = TestEnum.Value2;
+
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies a failure when the depends on member has a different type than the other property.
+ ///
+ [Fact]
+ public void VerifyFailureTypeMismatch()
+ {
+ CompareToOtherMemberTypeMismatch dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(DataAnnotationMemberHelper.TypeMismatchErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = TestEnum.Value1,
+ Property2 = TestEnum.Value1,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = TestEnum.Value2;
+ dataObject.Property2 = TestEnum.Value2;
+
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties don't equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = TestEnum.Value1,
+ Property2 = TestEnum.Value2,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = TestEnum.Value2;
+ dataObject.Property2 = TestEnum.Value1;
+
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is greater than.
+ ///
+ [Fact]
+ public void VerifyFailureGreaterThanNotSupported()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = TestEnum.Value1,
+ Property2 = TestEnum.Value2,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForEnumErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is greater than or equal.
+ ///
+ [Fact]
+ public void VerifyFailureGreaterThanOrEqualNotSupported()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = TestEnum.Value1,
+ Property2 = TestEnum.Value2,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForEnumErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is less than.
+ ///
+ [Fact]
+ public void VerifyFailureLessThanNotSupported()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = TestEnum.Value1,
+ Property2 = TestEnum.Value2,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForEnumErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is less than or equal.
+ ///
+ [Fact]
+ public void VerifyFailureLessThanOrEqualNotSupported()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = TestEnum.Value1,
+ Property2 = TestEnum.Value2,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForEnumErrorMessage, validationResults[0].ErrorMessage);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberFloatUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberFloatUnitTest.cs
new file mode 100644
index 0000000..cf15fc2
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberFloatUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Float;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the float data type.
+///
+public class CompareToOtherMemberFloatUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = float.MaxValue,
+ Property2 = float.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = float.MinValue;
+ dataObject.Property2 = float.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = float.MaxValue,
+ Property2 = float.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = float.MinValue;
+ dataObject.Property2 = float.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = float.MinValue,
+ Property2 = float.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = float.MaxValue,
+ Property2 = float.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = float.MinValue,
+ Property2 = float.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = float.MaxValue,
+ Property2 = float.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = float.MaxValue;
+ dataObject.Property2 = float.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = float.MaxValue,
+ Property2 = float.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = float.MinValue,
+ Property2 = float.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = float.MaxValue,
+ Property2 = float.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = float.MinValue,
+ Property2 = float.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = float.MaxValue;
+ dataObject.Property2 = float.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = float.MaxValue,
+ Property2 = float.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = float.MinValue;
+ dataObject.Property2 = float.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = float.MaxValue,
+ Property2 = float.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = float.MinValue;
+ dataObject.Property2 = float.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberIntUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberIntUnitTest.cs
new file mode 100644
index 0000000..47e55f4
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberIntUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Int;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the int data type.
+///
+public class CompareToOtherMemberIntUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = int.MaxValue,
+ Property2 = int.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = int.MinValue;
+ dataObject.Property2 = int.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = int.MaxValue,
+ Property2 = int.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = int.MinValue;
+ dataObject.Property2 = int.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = int.MinValue,
+ Property2 = int.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = int.MaxValue,
+ Property2 = int.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = int.MinValue,
+ Property2 = int.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = int.MaxValue,
+ Property2 = int.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = int.MaxValue;
+ dataObject.Property2 = int.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = int.MaxValue,
+ Property2 = int.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = int.MinValue,
+ Property2 = int.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = int.MaxValue,
+ Property2 = int.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = int.MinValue,
+ Property2 = int.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = int.MaxValue;
+ dataObject.Property2 = int.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = int.MaxValue,
+ Property2 = int.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = int.MinValue;
+ dataObject.Property2 = int.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = int.MaxValue,
+ Property2 = int.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = int.MinValue;
+ dataObject.Property2 = int.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberLongUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberLongUnitTest.cs
new file mode 100644
index 0000000..79cb64a
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberLongUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Long;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the long data type.
+///
+public class CompareToOtherMemberLongUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = long.MaxValue,
+ Property2 = long.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = long.MinValue;
+ dataObject.Property2 = long.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = long.MaxValue,
+ Property2 = long.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = long.MinValue;
+ dataObject.Property2 = long.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = long.MinValue,
+ Property2 = long.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = long.MaxValue,
+ Property2 = long.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = long.MinValue,
+ Property2 = long.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = long.MaxValue,
+ Property2 = long.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = long.MaxValue;
+ dataObject.Property2 = long.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = long.MaxValue,
+ Property2 = long.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = long.MinValue,
+ Property2 = long.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = long.MaxValue,
+ Property2 = long.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = long.MinValue,
+ Property2 = long.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = long.MaxValue;
+ dataObject.Property2 = long.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = long.MaxValue,
+ Property2 = long.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = long.MinValue;
+ dataObject.Property2 = long.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = long.MaxValue,
+ Property2 = long.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = long.MinValue;
+ dataObject.Property2 = long.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberSbyteUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberSbyteUnitTest.cs
new file mode 100644
index 0000000..cef7947
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberSbyteUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Sbyte;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the sbyte data type.
+///
+public class CompareToOtherMemberSsbyteUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = sbyte.MaxValue,
+ Property2 = sbyte.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = sbyte.MinValue;
+ dataObject.Property2 = sbyte.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = sbyte.MaxValue,
+ Property2 = sbyte.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = sbyte.MinValue;
+ dataObject.Property2 = sbyte.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = sbyte.MinValue,
+ Property2 = sbyte.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = sbyte.MaxValue,
+ Property2 = sbyte.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = sbyte.MinValue,
+ Property2 = sbyte.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = sbyte.MaxValue,
+ Property2 = sbyte.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = sbyte.MaxValue;
+ dataObject.Property2 = sbyte.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = sbyte.MaxValue,
+ Property2 = sbyte.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = sbyte.MinValue,
+ Property2 = sbyte.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = sbyte.MaxValue,
+ Property2 = sbyte.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = sbyte.MinValue,
+ Property2 = sbyte.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = sbyte.MaxValue;
+ dataObject.Property2 = sbyte.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = sbyte.MaxValue,
+ Property2 = sbyte.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = sbyte.MinValue;
+ dataObject.Property2 = sbyte.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = sbyte.MaxValue,
+ Property2 = sbyte.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = sbyte.MinValue;
+ dataObject.Property2 = sbyte.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberShortUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberShortUnitTest.cs
new file mode 100644
index 0000000..c3e8398
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberShortUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Short;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the short data type.
+///
+public class CompareToOtherMemberShortUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = short.MaxValue,
+ Property2 = short.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = short.MinValue;
+ dataObject.Property2 = short.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = short.MaxValue,
+ Property2 = short.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = short.MinValue;
+ dataObject.Property2 = short.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = short.MinValue,
+ Property2 = short.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = short.MaxValue,
+ Property2 = short.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = short.MinValue,
+ Property2 = short.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = short.MaxValue,
+ Property2 = short.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = short.MaxValue;
+ dataObject.Property2 = short.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = short.MaxValue,
+ Property2 = short.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = short.MinValue,
+ Property2 = short.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = short.MaxValue,
+ Property2 = short.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = short.MinValue,
+ Property2 = short.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = short.MaxValue;
+ dataObject.Property2 = short.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = short.MaxValue,
+ Property2 = short.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = short.MinValue;
+ dataObject.Property2 = short.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = short.MaxValue,
+ Property2 = short.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = short.MinValue;
+ dataObject.Property2 = short.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberStringUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberStringUnitTest.cs
new file mode 100644
index 0000000..1a79827
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberStringUnitTest.cs
@@ -0,0 +1,189 @@
+using JMayer.Data.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.String;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the string data type.
+///
+public class CompareToOtherMemberStringUnitTest
+{
+ ///
+ /// The constant for a string.
+ ///
+ private const string AString = "A String";
+
+ ///
+ /// The constant for a different string.
+ ///
+ private const string DifferentString = "Different String";
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = AString,
+ Property2 = DifferentString,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = DifferentString;
+ dataObject.Property2 = AString;
+
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = AString,
+ Property2 = AString,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = DifferentString;
+ dataObject.Property2 = DifferentString;
+
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = AString,
+ Property2 = AString,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = DifferentString;
+ dataObject.Property2 = DifferentString;
+
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties don't equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = AString,
+ Property2 = DifferentString,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = DifferentString;
+ dataObject.Property2 = AString;
+
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is greater than.
+ ///
+ [Fact]
+ public void VerifyFailureGreaterThanNotSupported()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = AString,
+ Property2 = DifferentString,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForStringErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is greater than or equal.
+ ///
+ [Fact]
+ public void VerifyFailureGreaterThanOrEqualNotSupported()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = AString,
+ Property2 = DifferentString,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForStringErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is less than.
+ ///
+ [Fact]
+ public void VerifyFailureLessThanNotSupported()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = AString,
+ Property2 = DifferentString,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForStringErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the the comparison operation is less than or equal.
+ ///
+ [Fact]
+ public void VerifyFailureLessThanOrEqualNotSupported()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = AString,
+ Property2 = DifferentString,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(CompareToOtherMemberAttribute.InvalidComparisonForStringErrorMessage, validationResults[0].ErrorMessage);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberTimeOnlyUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberTimeOnlyUnitTest.cs
new file mode 100644
index 0000000..e241fed
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberTimeOnlyUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeOnly;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the TimeOnly data type.
+///
+public class CompareToOtherMemberTimeOnlyUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = System.TimeOnly.MaxValue,
+ Property2 = System.TimeOnly.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = System.TimeOnly.MinValue;
+ dataObject.Property2 = System.TimeOnly.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = System.TimeOnly.MaxValue,
+ Property2 = System.TimeOnly.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.TimeOnly.MinValue;
+ dataObject.Property2 = System.TimeOnly.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = System.TimeOnly.MinValue,
+ Property2 = System.TimeOnly.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = System.TimeOnly.MaxValue,
+ Property2 = System.TimeOnly.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = System.TimeOnly.MinValue,
+ Property2 = System.TimeOnly.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = System.TimeOnly.MaxValue,
+ Property2 = System.TimeOnly.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.TimeOnly.MaxValue;
+ dataObject.Property2 = System.TimeOnly.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = System.TimeOnly.MaxValue,
+ Property2 = System.TimeOnly.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = System.TimeOnly.MinValue,
+ Property2 = System.TimeOnly.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = System.TimeOnly.MaxValue,
+ Property2 = System.TimeOnly.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = System.TimeOnly.MinValue,
+ Property2 = System.TimeOnly.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.TimeOnly.MaxValue;
+ dataObject.Property2 = System.TimeOnly.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = System.TimeOnly.MaxValue,
+ Property2 = System.TimeOnly.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = System.TimeOnly.MinValue;
+ dataObject.Property2 = System.TimeOnly.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = System.TimeOnly.MaxValue,
+ Property2 = System.TimeOnly.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.TimeOnly.MinValue;
+ dataObject.Property2 = System.TimeOnly.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberTimeSpanUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberTimeSpanUnitTest.cs
new file mode 100644
index 0000000..c5d1759
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberTimeSpanUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.TimeSpan;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the TimeSpan data type.
+///
+public class CompareToOtherMemberTimeSpanUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = System.TimeSpan.MaxValue,
+ Property2 = System.TimeSpan.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = System.TimeSpan.MinValue;
+ dataObject.Property2 = System.TimeSpan.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = System.TimeSpan.MaxValue,
+ Property2 = System.TimeSpan.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.TimeSpan.MinValue;
+ dataObject.Property2 = System.TimeSpan.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = System.TimeSpan.MinValue,
+ Property2 = System.TimeSpan.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = System.TimeSpan.MaxValue,
+ Property2 = System.TimeSpan.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = System.TimeSpan.MinValue,
+ Property2 = System.TimeSpan.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = System.TimeSpan.MaxValue,
+ Property2 = System.TimeSpan.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.TimeSpan.MaxValue;
+ dataObject.Property2 = System.TimeSpan.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = System.TimeSpan.MaxValue,
+ Property2 = System.TimeSpan.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = System.TimeSpan.MinValue,
+ Property2 = System.TimeSpan.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = System.TimeSpan.MaxValue,
+ Property2 = System.TimeSpan.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = System.TimeSpan.MinValue,
+ Property2 = System.TimeSpan.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.TimeSpan.MaxValue;
+ dataObject.Property2 = System.TimeSpan.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = System.TimeSpan.MaxValue,
+ Property2 = System.TimeSpan.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = System.TimeSpan.MinValue;
+ dataObject.Property2 = System.TimeSpan.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = System.TimeSpan.MaxValue,
+ Property2 = System.TimeSpan.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = System.TimeSpan.MinValue;
+ dataObject.Property2 = System.TimeSpan.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberUintUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberUintUnitTest.cs
new file mode 100644
index 0000000..440a7ce
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberUintUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Uint;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the uint data type.
+///
+public class CompareToOtherMemberUuintUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = uint.MaxValue,
+ Property2 = uint.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = uint.MinValue;
+ dataObject.Property2 = uint.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = uint.MaxValue,
+ Property2 = uint.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = uint.MinValue;
+ dataObject.Property2 = uint.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = uint.MinValue,
+ Property2 = uint.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = uint.MaxValue,
+ Property2 = uint.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = uint.MinValue,
+ Property2 = uint.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = uint.MaxValue,
+ Property2 = uint.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = uint.MaxValue;
+ dataObject.Property2 = uint.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = uint.MaxValue,
+ Property2 = uint.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = uint.MinValue,
+ Property2 = uint.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = uint.MaxValue,
+ Property2 = uint.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = uint.MinValue,
+ Property2 = uint.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = uint.MaxValue;
+ dataObject.Property2 = uint.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = uint.MaxValue,
+ Property2 = uint.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = uint.MinValue;
+ dataObject.Property2 = uint.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = uint.MaxValue,
+ Property2 = uint.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = uint.MinValue;
+ dataObject.Property2 = uint.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberUlongUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberUlongUnitTest.cs
new file mode 100644
index 0000000..10155cd
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberUlongUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Ulong;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the ulong data type.
+///
+public class CompareToOtherMemberUulongUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = ulong.MaxValue,
+ Property2 = ulong.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = ulong.MinValue;
+ dataObject.Property2 = ulong.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = ulong.MaxValue,
+ Property2 = ulong.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = ulong.MinValue;
+ dataObject.Property2 = ulong.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = ulong.MinValue,
+ Property2 = ulong.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = ulong.MaxValue,
+ Property2 = ulong.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = ulong.MinValue,
+ Property2 = ulong.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = ulong.MaxValue,
+ Property2 = ulong.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = ulong.MaxValue;
+ dataObject.Property2 = ulong.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = ulong.MaxValue,
+ Property2 = ulong.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = ulong.MinValue,
+ Property2 = ulong.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = ulong.MaxValue,
+ Property2 = ulong.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = ulong.MinValue,
+ Property2 = ulong.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = ulong.MaxValue;
+ dataObject.Property2 = ulong.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = ulong.MaxValue,
+ Property2 = ulong.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = ulong.MinValue;
+ dataObject.Property2 = ulong.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = ulong.MaxValue,
+ Property2 = ulong.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = ulong.MinValue;
+ dataObject.Property2 = ulong.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberUnitTest.cs
new file mode 100644
index 0000000..9ae9963
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberUnitTest.cs
@@ -0,0 +1,135 @@
+using JMayer.Data.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages general tests for the CompareToOtherMemberAttribute object.
+///
+public class CompareToOtherMemberUnitTest
+{
+ ///
+ /// The method verifies an argument null exception is thrown when null is passed into the constructor for the conditionValue parameter.
+ ///
+ [Fact]
+ public void VerifyConstructorThrowsArgumentNullExceptionForOtherMemberNameParameter() => Assert.Throws(() => new CompareToOtherMemberAttribute(null!, ComparisonOperation.Equal));
+
+ ///
+ /// The method verifies when the passIfOtherMemberIsNull parameter is false and the other member is null, it'll fail.
+ ///
+ [Fact]
+ public void VerifyFailureIfOtherMemberIsNull()
+ {
+ CompareOtherMemberFailOtherMemberIfNull dataObject = new()
+ {
+ Property1 = string.Empty,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareOtherMemberFailOtherMemberIfNull.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareOtherMemberFailOtherMemberIfNull.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies when the passIfRegisteredMemberIsNull parameter is false and the registered member is null, it'll fail.
+ ///
+ [Fact]
+ public void VerifyFailureIfRegisteredMemberIsNull()
+ {
+ CompareOtherMemberFailRegisteredMemberIfNull dataObject = new()
+ {
+ Property2 = string.Empty,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareOtherMemberFailRegisteredMemberIfNull.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareOtherMemberFailRegisteredMemberIfNull.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies a failure when the types are invalid.
+ ///
+ [Fact]
+ public void VerifyFailureInvalidType()
+ {
+ CompareToOtherMemberInvalidType dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(DataAnnotationMemberHelper.InvalidTypeErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the depends on member is not found.
+ ///
+ [Fact]
+ public void VerifyFailureMemberNameNotFound()
+ {
+ CompareToOtherMemberNotFound dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(DataAnnotationMemberHelper.MemberNotFoundErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the depends on member is the same member of the evaluating member.
+ ///
+ [Fact]
+ public void VerifyFailureSameMember()
+ {
+ CompareToOtherMemberSameMember dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(DataAnnotationMemberHelper.SameMemberErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the depends on member has a different type than the other property.
+ ///
+ [Fact]
+ public void VerifyFailureTypeMismatch()
+ {
+ CompareToOtherMemberTypeMismatch dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(DataAnnotationMemberHelper.TypeMismatchErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies when the passIfOtherMemberIsNull parameter is true and the other member is null, it'll pass.
+ ///
+ [Fact]
+ public void VerifyPassIfOtherMemberIsNull()
+ {
+ CompareOtherMemberPassOtherMemberIfNull dataObject = new()
+ {
+ Property1 = string.Empty,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies when the passIfRegisteredMemberIsNull parameter is true and the registered member is null, it'll pass.
+ ///
+ [Fact]
+ public void VerifyPassIfRegisteredMemberIsNull()
+ {
+ CompareOtherMemberPassRegisteredMemberIfNull dataObject = new()
+ {
+ Property2 = string.Empty,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/CompareToOtherMemberUshortUnitTest.cs b/TestProject/Test/DataAnnotations/CompareToOtherMemberUshortUnitTest.cs
new file mode 100644
index 0000000..5698106
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/CompareToOtherMemberUshortUnitTest.cs
@@ -0,0 +1,252 @@
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations.CompareToOtherMembers.Ushort;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the CompareToOtherMemberAttribute object for the ushort data type.
+///
+public class CompareToOtherMemberUushortUnitTest
+{
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualFailure()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = ushort.MaxValue,
+ Property2 = ushort.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = ushort.MinValue;
+ dataObject.Property2 = ushort.MaxValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyEqualSuccess()
+ {
+ CompareToOtherMemberEqual dataObject = new()
+ {
+ Property1 = ushort.MaxValue,
+ Property2 = ushort.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = ushort.MinValue;
+ dataObject.Property2 = ushort.MinValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanFailure()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = ushort.MinValue,
+ Property2 = ushort.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the prperty 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanSuccess()
+ {
+ CompareToOtherMemberGreaterThan dataObject = new()
+ {
+ Property1 = ushort.MaxValue,
+ Property2 = ushort.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualFailure()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = ushort.MinValue,
+ Property2 = ushort.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberGreaterThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is greater than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyGreaterThanOrEqualSuccess()
+ {
+ CompareToOtherMemberGreaterThanOrEqual dataObject = new()
+ {
+ Property1 = ushort.MaxValue,
+ Property2 = ushort.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = ushort.MaxValue;
+ dataObject.Property2 = ushort.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanFailure()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = ushort.MaxValue,
+ Property2 = ushort.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThan.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanSuccess()
+ {
+ CompareToOtherMemberLessThan dataObject = new()
+ {
+ Property1 = ushort.MinValue,
+ Property2 = ushort.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the property 1 is greater than property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualFailure()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = ushort.MaxValue,
+ Property2 = ushort.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberLessThanOrEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the property 1 is less than or equal property 2.
+ ///
+ [Fact]
+ public void VerifyLessThanOrEqualSuccess()
+ {
+ CompareToOtherMemberLessThanOrEqual dataObject = new()
+ {
+ Property1 = ushort.MinValue,
+ Property2 = ushort.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = ushort.MaxValue;
+ dataObject.Property2 = ushort.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return failure when the two properties do not equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualFailure()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = ushort.MaxValue,
+ Property2 = ushort.MaxValue,
+ };
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+
+ dataObject.Property1 = ushort.MinValue;
+ dataObject.Property2 = ushort.MinValue;
+ validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(2, validationResults[0].MemberNames.Count());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property1), validationResults[0].MemberNames.First());
+ Assert.Equal(nameof(CompareToOtherMemberNotEqual.Property2), validationResults[0].MemberNames.Last());
+ }
+
+ ///
+ /// The method verifies the CompareToOther data annotation return success when the two properties equal each other.
+ ///
+ [Fact]
+ public void VerifyNotEqualSuccess()
+ {
+ CompareToOtherMemberNotEqual dataObject = new()
+ {
+ Property1 = ushort.MaxValue,
+ Property2 = ushort.MinValue,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+
+ dataObject.Property1 = ushort.MinValue;
+ dataObject.Property2 = ushort.MaxValue;
+ validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/DataAnnotations/RequiredDependsOnUnitTest.cs b/TestProject/Test/DataAnnotations/RequiredDependsOnUnitTest.cs
new file mode 100644
index 0000000..3437dcd
--- /dev/null
+++ b/TestProject/Test/DataAnnotations/RequiredDependsOnUnitTest.cs
@@ -0,0 +1,216 @@
+using JMayer.Data.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
+using TestProject.Data.DataAnnotations;
+
+namespace TestProject.Test.DataAnnotations;
+
+///
+/// The class manages tests for the RequiredDependsOnAttribute object.
+///
+public class RequiredDependsOnUnitTest
+{
+ ///
+ /// The method verifies an argument null exception is thrown when null is passed into the constructor for the conditionValue parameter.
+ ///
+ [Fact]
+ public void VerifyConstructorThrowsArgumentNullExceptionForConditionValueParameter() => Assert.Throws(() => new RequiredDependsOnAttribute("A Member", null!));
+
+ ///
+ /// The method verifies an argument exception is thrown when an empty string is passed into the constructor for the dependentMemberName parameter.
+ ///
+ [Fact]
+ public void VerifyConstructorThrowsArgumentExceptionForDependentMemberNameParameter() => Assert.Throws(() => new RequiredDependsOnAttribute(string.Empty, true));
+
+ ///
+ /// The method verifies an argument null exception is thrown when null is passed into the constructor for the dependentMemberName parameter.
+ ///
+ [Fact]
+ public void VerifyConstructorThrowsArgumentNullExceptionForDependentMemberNameParameter() => Assert.Throws(() => new RequiredDependsOnAttribute(null!, true));
+
+ ///
+ /// The method verifies a failure when the types are invalid.
+ ///
+ [Fact]
+ public void VerifyFailureInvalidType()
+ {
+ RequiredDependsOnInvalidType dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(DataAnnotationMemberHelper.InvalidTypeErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the depends on member is not found.
+ ///
+ [Fact]
+ public void VerifyFailureMemberNameNotFound()
+ {
+ RequiredDependsOnMemberNotFound dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(DataAnnotationMemberHelper.MemberNotFoundErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the depends on member is the same member of the evaluating member.
+ ///
+ [Fact]
+ public void VerifyFailureSameMember()
+ {
+ RequiredDependsOnSameMemeber dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(DataAnnotationMemberHelper.SameMemberErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies a failure when the depends on member has a different type than the condition value.
+ ///
+ [Fact]
+ public void VerifyFailureTypeMismatch()
+ {
+ RequiredDependsOnTypeMismatch dataObject = new();
+ List validationResults = dataObject.Validate();
+
+ Assert.Single(validationResults);
+ Assert.Equal(DataAnnotationMemberHelper.TypeMismatchErrorMessage, validationResults[0].ErrorMessage);
+ }
+
+ ///
+ /// The method verifies the Required data annotation is evaluated when depends on condition is set to the required enum value.
+ ///
+ [Theory]
+ [InlineData("")]
+ [InlineData("Text")]
+ public void VerifyRequiredDependsOnEnumConditionEvaluated(string conditionalRequireValue)
+ {
+ RequiredDependsOnEnum dataObject = new()
+ {
+ ConditionalRequireValue = conditionalRequireValue,
+ DependentOnMember = ConditionalEnum.Condition2,
+ };
+ List validationResults = dataObject.Validate();
+
+ if (conditionalRequireValue.Length > 0)
+ {
+ Assert.Empty(validationResults);
+ }
+ else
+ {
+ Assert.Single(validationResults);
+ Assert.Equal($"The {nameof(RequiredDependsOnTrue.ConditionalRequireValue)} field is required.", validationResults[0].ErrorMessage);
+ Assert.Single(validationResults[0].MemberNames);
+ Assert.Equal(nameof(RequiredDependsOnTrue.ConditionalRequireValue), validationResults[0].MemberNames.First());
+ }
+ }
+
+ ///
+ /// The method verifies the Required data annotation is ignored.
+ ///
+ [Theory]
+ [InlineData("")]
+ [InlineData("Text")]
+ public void VerifyRequiredDependsOnEnumConditionIgnored(string conditionalRequireValue)
+ {
+ RequiredDependsOnEnum dataObject = new()
+ {
+ ConditionalRequireValue = conditionalRequireValue,
+ DependentOnMember = ConditionalEnum.Condition1,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the Required data annotation is evaluated when depends on condition is true.
+ ///
+ [Theory]
+ [InlineData("")]
+ [InlineData("Text")]
+ public void VerifyRequiredDependsOnFalseConditionEvaluated(string conditionalRequireValue)
+ {
+ RequiredDependsOnFalse dataObject = new()
+ {
+ ConditionalRequireValue = conditionalRequireValue,
+ DependentOnMember = false,
+ };
+ List validationResults = dataObject.Validate();
+
+ if (conditionalRequireValue.Length > 0)
+ {
+ Assert.Empty(validationResults);
+ }
+ else
+ {
+ Assert.Single(validationResults);
+ Assert.Equal($"The {nameof(RequiredDependsOnTrue.ConditionalRequireValue)} field is required.", validationResults[0].ErrorMessage);
+ Assert.Single(validationResults[0].MemberNames);
+ Assert.Equal(nameof(RequiredDependsOnTrue.ConditionalRequireValue), validationResults[0].MemberNames.First());
+ }
+ }
+
+ ///
+ /// The method verifies the Required data annotation is ignored.
+ ///
+ [Theory]
+ [InlineData("")]
+ [InlineData("Text")]
+ public void VerifyRequiredDependsOnFalseConditionIgnored(string conditionalRequireValue)
+ {
+ RequiredDependsOnFalse dataObject = new()
+ {
+ ConditionalRequireValue = conditionalRequireValue,
+ DependentOnMember = true,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+
+ ///
+ /// The method verifies the Required data annotation is evaluated when depends on condition is true.
+ ///
+ [Theory]
+ [InlineData("")]
+ [InlineData("Text")]
+ public void VerifyRequiredDependsOnTrueConditionEvaluated(string conditionalRequireValue)
+ {
+ RequiredDependsOnTrue dataObject = new()
+ {
+ ConditionalRequireValue = conditionalRequireValue,
+ DependentOnMember = true,
+ };
+ List validationResults = dataObject.Validate();
+
+ if (conditionalRequireValue.Length > 0)
+ {
+ Assert.Empty(validationResults);
+ }
+ else
+ {
+ Assert.Single(validationResults);
+ Assert.Equal($"The {nameof(RequiredDependsOnTrue.ConditionalRequireValue)} field is required.", validationResults[0].ErrorMessage);
+ Assert.Single(validationResults[0].MemberNames);
+ Assert.Equal(nameof(RequiredDependsOnTrue.ConditionalRequireValue), validationResults[0].MemberNames.First());
+ }
+ }
+
+ ///
+ /// The method verifies the Required data annotation is ignored.
+ ///
+ [Theory]
+ [InlineData("")]
+ [InlineData("Text")]
+ public void VerifyRequiredDependsOnTrueConditionIgnored(string conditionalRequireValue)
+ {
+ RequiredDependsOnTrue dataObject = new()
+ {
+ ConditionalRequireValue = conditionalRequireValue,
+ DependentOnMember = false,
+ };
+ List validationResults = dataObject.Validate();
+ Assert.Empty(validationResults);
+ }
+}
diff --git a/TestProject/Test/Database/StandardCRUDDataLayerUnitTest.cs b/TestProject/Test/Database/StandardCRUDDataLayerUnitTest.cs
index 6bc14f0..252a2ad 100644
--- a/TestProject/Test/Database/StandardCRUDDataLayerUnitTest.cs
+++ b/TestProject/Test/Database/StandardCRUDDataLayerUnitTest.cs
@@ -80,8 +80,8 @@ public async Task VerifyCount()
{
SimpleStandardDataLayer dataLayer = new();
- _ = await dataLayer.CreateAsync(new SimpleDataObject() { Name = DefaultName });
- long count = await dataLayer.CountAsync();
+ _ = await dataLayer.CreateAsync(new SimpleDataObject() { Name = DefaultName }, TestContext.Current.CancellationToken);
+ long count = await dataLayer.CountAsync(TestContext.Current.CancellationToken);
Assert.Equal(1, count);
}
@@ -90,7 +90,7 @@ public async Task VerifyCount()
/// The method verifies if a null data object is passed to the StandardCRUDDataLayer.CountAsync(), an exception is thrown.
///
[Fact]
- public async Task VerifyCountThrowsArgumentNullException() => await Assert.ThrowsAsync(() => new SimpleStandardDataLayer().CountAsync(null));
+ public async Task VerifyCountThrowsArgumentNullException() => await Assert.ThrowsAsync(() => new SimpleStandardDataLayer().CountAsync(null!, TestContext.Current.CancellationToken));
///