예제 #1
0
        public void MinValueAttribute_SetsMinimum()
        {
            Decimal actual   = new MinValueAttribute(12.56).Minimum;
            Decimal expected = 12.56M;

            Assert.Equal(expected, actual);
        }
예제 #2
0
        public void FormatErrorMessage_ForName()
        {
            attribute = new MinValueAttribute(12.56);

            String actual   = attribute.FormatErrorMessage("Sum");
            String expected = Validation.For("MinValue", "Sum", attribute.Minimum);

            Assert.Equal(expected, actual);
        }
예제 #3
0
 public IAttributeAdapter?GetAttributeAdapter(ValidationAttribute attribute, IStringLocalizer?stringLocalizer)
 {
     return(attribute switch
     {
         StringLengthAttribute stringLength => new StringLengthAdapter(stringLength),
         GreaterThanAttribute greaterThan => new GreaterThanAdapter(greaterThan),
         AcceptFilesAttribute acceptFiles => new AcceptFilesAdapter(acceptFiles),
         MinLengthAttribute minLength => new MinLengthAdapter(minLength),
         MaxLengthAttribute maxLength => new MaxLengthAdapter(maxLength),
         EmailAddressAttribute email => new EmailAddressAdapter(email),
         RequiredAttribute required => new RequiredAdapter(required),
         MaxValueAttribute maxValue => new MaxValueAdapter(maxValue),
         MinValueAttribute minValue => new MinValueAdapter(minValue),
         LessThanAttribute lessThan => new LessThanAdapter(lessThan),
         FileSizeAttribute fileSize => new FileSizeAdapter(fileSize),
         NumericAttribute numeric => new NumericAdapter(numeric),
         EqualToAttribute equalTo => new EqualToAdapter(equalTo),
         IntegerAttribute integer => new IntegerAdapter(integer),
         DigitsAttribute digits => new DigitsAdapter(digits),
         RangeAttribute range => new RangeAdapter(range),
         _ => null
     });
예제 #4
0
 public MinValueAttributeTests()
 {
     attribute = new MinValueAttribute(12.56);
 }