public void HandleValidations(IBase baseObject, IValidationSet validationSet, Attribute[] attributes)
        {
            var requiredAttribute = attributes.OfType <RequiredAttribute>().Single();
            var errorMessage      = string.Format("{0} is required", baseObject.GetDisplayName());
            var candidateKey      = errorMessage.ToConstantName();
            var key = validationSet.AddTranslation(baseObject, candidateKey, errorMessage, true);

            validationSet.AddValidationEntry("required", "Validators.required", key, "Required Value", null);
        }
        public void HandleValidations(IBase baseObject, IValidationSet validationSet, Attribute[] attributes)
        {
            var maxLengthAttribute = attributes.OfType <MaxLengthAttribute>().Single();
            var name         = baseObject.GetDisplayName();
            var length       = maxLengthAttribute.Length;
            var errorMessage = maxLengthAttribute.ErrorMessage ?? string.Format("Maximum of {0} characters", length);
            var candidateKey = errorMessage.ToConstantName();
            var key          = validationSet.AddTranslation(baseObject, candidateKey, errorMessage, true);
            var validValue   = length.CreateTestStringOfLength();
            var invalidValue = (length + 1).CreateTestStringOfLength();

            validationSet.AddValidationEntry("required", string.Format("Validators.maxLength({0})", maxLengthAttribute.Length), key, validValue, invalidValue);
        }