Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Immediate.Validations.Analyzers/DiagnosticIds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public static class DiagnosticIds
public const string IV0007ValidateMethodParameterIsIncorrectType = "IV0007";
public const string IV0008ValidatePropertyMustBeRequired = "IV0008";
public const string IV0009ValidatorHasTooManyConstructors = "IV0009";
public const string IV0019ValidatorIsMissingDefaultMessage = "IV0019";
public const string IV0010ValidatorIsMissingDefaultMessage = "IV0010";

public const string IV0011AssemblyBehaviorsShouldUseValidation = "IV0011";
Expand All @@ -20,7 +19,6 @@ public static class DiagnosticIds
public const string IV0013IValidationTargetMissing = "IV0013";
public const string IV0014ValidatePropertyIncompatibleType = "IV0014";
public const string IV0015ValidateParameterIncompatibleType = "IV0015";
public const string IV0016ValidateParameterPropertyIncompatibleType = "IV0016";
public const string IV0017ValidateParameterNameofInvalid = "IV0017";
public const string IV0018ValidateNotNullWhenInvalid = "IV0018";
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ A value of invalid type was provided to the validator.
| Severity | Warning |
| CodeFix | False |

## IV0016: Parameter is incompatible type
## IV0016: Parameter is incompatible type (Removed in 2.3)

A `nameof()` reference of invalid type was provided to the validator.

| Item | Value |
|----------|----------------------|
| Category | ImmediateValidations |
| Enabled | True |
| Enabled | False |
| Severity | Warning |
| CodeFix | False |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ private static Dictionary<string, LocalizedString> En() =>
[nameof(LessThanAttribute)] = "'{PropertyName}' must be less than '{ComparisonValue}'.",
[nameof(LessThanOrEqualAttribute)] = "'{PropertyName}' must be less than or equal to '{ComparisonValue}'.",
[nameof(MatchAttribute)] = "'{PropertyName}' is not in the correct format.",
[nameof(MaxLengthAttribute)] = "'{PropertyName}' must be less than {MaxLengthValue} characters.",
[nameof(MinLengthAttribute)] = "'{PropertyName}' must be more than {MinLengthValue} characters.",
[nameof(MaxLengthAttribute)] = "'{PropertyName}' must be at most {MaxLengthValue} characters.",
[nameof(MinLengthAttribute)] = "'{PropertyName}' must be at least {MinLengthValue} characters.",
[nameof(NotEmptyAttribute)] = "'{PropertyName}' must not be empty.",
[nameof(NotEqualAttribute)] = "'{PropertyName}' must not be equal to '{ComparisonValue}'.",
[nameof(NotNullAttribute)] = "'{PropertyName}' must not be null.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ private static Dictionary<string, LocalizedString> Fr() =>
[nameof(LessThanAttribute)] = "'{PropertyName}' doit être inférieur à '{ComparisonValue}'.",
[nameof(LessThanOrEqualAttribute)] = "'{PropertyName}' doit être inférieur ou égal à '{ComparisonValue}'.",
[nameof(MatchAttribute)] = "'{PropertyName}' n'est pas au bon format.",
[nameof(MaxLengthAttribute)] = "'{PropertyName}' doit être inférieur à {MaxLengthValue} caractères.",
[nameof(MinLengthAttribute)] = "'{PropertyName}' doit être supérieur à {MinLengthValue} caractères.",
[nameof(MaxLengthAttribute)] = "'{PropertyName}' doit avoir au plus {MaxLengthValue} caractères.",
[nameof(MinLengthAttribute)] = "'{PropertyName}' doit avoir au moins {MinLengthValue} caractères.",
[nameof(NotEmptyAttribute)] = "'{PropertyName}' ne doit pas être vide.",
[nameof(NotEqualAttribute)] = "'{PropertyName}' ne doit pas être égal à '{ComparisonValue}'.",
[nameof(NotNullAttribute)] = "'{PropertyName}' ne doit pas être nul.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void ShortIdHasErrors()
new()
{
PropertyName = "Id",
ErrorMessage = "'Id' must be more than 4 characters.",
ErrorMessage = "'Id' must be at least 4 characters.",
},
],
errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ public void MaxLengthWhenShort()
Assert.Empty(errors);
}

[Fact]
public void MaxLengthWhenExactBoundary()
{
var instance = new StringRecord { StringValue = new string('a', 30) };

var errors = StringRecord.Validate(instance);

Assert.Empty(errors);
}

[Fact]
public void MaxLengthWhenLong()
{
Expand All @@ -33,7 +43,7 @@ public void MaxLengthWhenLong()
new()
{
PropertyName = nameof(StringRecord.StringValue),
ErrorMessage = "'String Value' must be less than 30 characters.",
ErrorMessage = "'String Value' must be at most 30 characters.",
},
],
errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ public void MinLengthWhenShort()
Assert.Empty(errors);
}

[Fact]
public void MinLengthWhenExactBoundary()
{
var instance = new StringRecord { StringValue = new string('a', 30) };

var errors = StringRecord.Validate(instance);

Assert.Empty(errors);
}

[Fact]
public void MinLengthWhenLong()
{
Expand All @@ -33,7 +43,7 @@ public void MinLengthWhenLong()
new()
{
PropertyName = nameof(StringRecord.StringValue),
ErrorMessage = "'String Value' must be more than 30 characters.",
ErrorMessage = "'String Value' must be at least 30 characters.",
},
],
errors
Expand Down