Changed min/max parameter order in StringLengthAttributeAdapter
This commit is contained in:
parent
f8c7f1ab78
commit
d19765802b
|
|
@ -54,8 +54,8 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
|
||||||
return GetErrorMessage(
|
return GetErrorMessage(
|
||||||
validationContext.ModelMetadata,
|
validationContext.ModelMetadata,
|
||||||
validationContext.ModelMetadata.GetDisplayName(),
|
validationContext.ModelMetadata.GetDisplayName(),
|
||||||
Attribute.MinimumLength,
|
Attribute.MaximumLength,
|
||||||
Attribute.MaximumLength);
|
Attribute.MinimumLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -417,7 +417,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
|
||||||
{
|
{
|
||||||
new StringLengthAttribute(length) { ErrorMessage = LocalizationKey, MinimumLength = 1},
|
new StringLengthAttribute(length) { ErrorMessage = LocalizationKey, MinimumLength = 1},
|
||||||
string.Empty,
|
string.Empty,
|
||||||
new object[] { nameof(SampleModel), 1, length }
|
new object[] { nameof(SampleModel), length, 1 }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
new RangeAttribute(0, length) { ErrorMessage = LocalizationKey },
|
new RangeAttribute(0, length) { ErrorMessage = LocalizationKey },
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
|
||||||
var expectedMessage = "Property must not be longer than '8' characters.";
|
var expectedMessage = "Property must not be longer than '8' characters.";
|
||||||
|
|
||||||
var stringLocalizer = new Mock<IStringLocalizer>();
|
var stringLocalizer = new Mock<IStringLocalizer>();
|
||||||
var expectedProperties = new object[] { "Length", 0, 8 };
|
var expectedProperties = new object[] { "Length", 8, 0 };
|
||||||
|
|
||||||
stringLocalizer.Setup(s => s[attribute.ErrorMessage, expectedProperties])
|
stringLocalizer.Setup(s => s[attribute.ErrorMessage, expectedProperties])
|
||||||
.Returns(new LocalizedString(attribute.ErrorMessage, expectedMessage));
|
.Returns(new LocalizedString(attribute.ErrorMessage, expectedMessage));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue