public void AcceptFilesAttribute_SetsExtensions() { String actual = new AcceptFilesAttribute(".docx,.xlsx").Extensions; String expected = ".docx,.xlsx"; Assert.Equal(expected, actual); }
public void FormatErrorMessage_ForProperty() { attribute = new AcceptFilesAttribute(".docx,.xlsx"); String expected = Validation.For("AcceptFiles", "File", attribute.Extensions); String actual = attribute.FormatErrorMessage("File"); Assert.Equal(expected, actual); }
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 });
public AcceptFilesAttributeTests() { attribute = new AcceptFilesAttribute(".docx,.xlsx"); }