public void StringMaxLength() { var schema = new SimpleTypeSchema("Currency", typeof(string)) .SetStringMaxLength(3); schema.GetStringMaxLength() !.MaxLength.Should().Be(3); Property <string> currency = new Property <string>("Currency") .SetSchema(schema); var validationRules = ValidationProvider.Instance.GetValidationRules(currency).ToList(); validationRules.Should().HaveCount(1); var messages = new MutablePropertyContainer() .WithValue(currency, "USD") .Validate(validationRules) .ToList(); messages.Should().BeEmpty(); messages = new MutablePropertyContainer() .WithValue(currency, "abcd") .Validate(validationRules) .ToList(); messages[0].FormattedMessage.Should().Be("Value 'abcd' is too long (length: 4, maxLength: 3)"); }