Browse Source

Merge pull request #318 from Avd6977/patch-1

Update language in validation messages
pull/320/head
Sebastian Stehle 7 years ago
committed by GitHub
parent
commit
1e35be5cfd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/RangeValidator.cs
  2. 4
      src/Squidex.Infrastructure/Guard.cs
  3. 4
      tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ContentValidationTests.cs
  4. 4
      tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/DateTimeFieldTests.cs
  5. 4
      tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/NumberFieldTests.cs
  6. 4
      tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/CollectionItemValidatorTests.cs
  7. 4
      tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RangeValidatorTests.cs

6
src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/RangeValidator.cs

@ -38,15 +38,15 @@ namespace Squidex.Domain.Apps.Core.ValidateContent.Validators
if (min.HasValue && typedValue.CompareTo(min.Value) < 0)
{
addError(context.Path, $"Must be greater or equals than '{min}'.");
addError(context.Path, $"Must be greater than or equal to '{min}'.");
}
if (max.HasValue && typedValue.CompareTo(max.Value) > 0)
{
addError(context.Path, $"Must be less or equals than '{max}'.");
addError(context.Path, $"Must be less than or equal to '{max}'.");
}
return TaskHelper.Done;
}
}
}
}

4
src/Squidex.Infrastructure/Guard.cs

@ -116,7 +116,7 @@ namespace Squidex.Infrastructure
{
if (target.CompareTo(lower) < 0)
{
throw new ArgumentException($"Value must be greater or equals than {lower}", parameterName);
throw new ArgumentException($"Value must be greater than or equal to {lower}", parameterName);
}
}
@ -136,7 +136,7 @@ namespace Squidex.Infrastructure
{
if (target.CompareTo(upper) > 0)
{
throw new ArgumentException($"Value must be less or equals than {upper}", parameterName);
throw new ArgumentException($"Value must be less than or equal to {upper}", parameterName);
}
}

4
tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ContentValidationTests.cs

@ -59,7 +59,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent
errors.Should().BeEquivalentTo(
new List<ValidationError>
{
new ValidationError("my-field: Must be less or equals than '100'.", "my-field")
new ValidationError("my-field: Must be less than or equal to '100'.", "my-field")
});
}
@ -221,7 +221,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent
errors.Should().BeEquivalentTo(
new List<ValidationError>
{
new ValidationError("my-field: Must be less or equals than '100'.", "my-field")
new ValidationError("my-field: Must be less than or equal to '100'.", "my-field")
});
}

4
tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/DateTimeFieldTests.cs

@ -57,7 +57,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent
await sut.ValidateAsync(CreateValue(FutureDays(0)), errors);
errors.Should().BeEquivalentTo(
new[] { $"Must be greater or equals than '{FutureDays(10)}'." });
new[] { $"Must be greater than or equal to '{FutureDays(10)}'." });
}
[Fact]
@ -68,7 +68,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent
await sut.ValidateAsync(CreateValue(FutureDays(20)), errors);
errors.Should().BeEquivalentTo(
new[] { $"Must be less or equals than '{FutureDays(10)}'." });
new[] { $"Must be less than or equal to '{FutureDays(10)}'." });
}
[Fact]

4
tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/NumberFieldTests.cs

@ -56,7 +56,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent
await sut.ValidateAsync(CreateValue(5), errors);
errors.Should().BeEquivalentTo(
new[] { "Must be greater or equals than '10'." });
new[] { "Must be greater than or equal to '10'." });
}
[Fact]
@ -67,7 +67,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent
await sut.ValidateAsync(CreateValue(20), errors);
errors.Should().BeEquivalentTo(
new[] { "Must be less or equals than '10'." });
new[] { "Must be less than or equal to '10'." });
}
[Fact]

4
tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/CollectionItemValidatorTests.cs

@ -47,8 +47,8 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators
errors.Should().BeEquivalentTo(
new[]
{
"[2]: Must be greater or equals than '2'.",
"[4]: Must be less or equals than '4'."
"[2]: Must be greater than or equal to '2'.",
"[4]: Must be less than or equal to '4'."
});
}
}

4
tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RangeValidatorTests.cs

@ -58,7 +58,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators
await sut.ValidateAsync(1500, errors);
errors.Should().BeEquivalentTo(
new[] { "Must be greater or equals than '2000'." });
new[] { "Must be greater than or equal to '2000'." });
}
[Fact]
@ -69,7 +69,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators
await sut.ValidateAsync(1500, errors);
errors.Should().BeEquivalentTo(
new[] { "Must be less or equals than '1000'." });
new[] { "Must be less than or equal to '1000'." });
}
}
}

Loading…
Cancel
Save