public void CompareValues_InvalidOtherProperty_ThrowsInvalidOperationException() { ComparisonEntity entity = CreateComparisonEntity(); ValidationContext validationContext = new ValidationContext(entity) { MemberName = "Minimum" }; CompareValuesAttribute attribute = new CompareValuesAttribute( "InvalidProperty", ComparisonCriteria.EqualTo); Assert.Throws<InvalidOperationException>( () => attribute.Validate(entity.Minimum, validationContext)); }
public void CompareValues_DifferentTypedProperties_ThrowsInvalidOperationException() { ComparisonEntity entity = CreateComparisonEntity(); ValidationContext validationContext = new ValidationContext(entity) { MemberName = "Minimum" }; CompareValuesAttribute attribute = new CompareValuesAttribute( "StringType", ComparisonCriteria.LessThan); // Act Assert.Throws<InvalidOperationException>( () => attribute.Validate(entity.Minimum, validationContext)); }