Exemplo n.º 1
0
        public override bool IsValid(object?value)
        {
            if (value == null)
            {
                return(CanBeNull);
            }

            return(value is string text && ValidationMethods.IsPassword(text));
        }
Exemplo n.º 2
0
        public static string?NotPassword([ValidatedNotNull] string?password, string paramName, bool canBeNull)
        {
            if (canBeNull && password == null)
            {
                return(password);
            }

            if (!ValidationMethods.IsPassword(password))
            {
                throw new ArgumentException(HB.Framework.Common.Properties.Resources.NotPasswordErrorMessage, paramName);
            }

            return(password);
        }
Exemplo n.º 3
0
        public static string?NotPassword(string?password, string paramName, bool canBeNull)
        {
            if (canBeNull && password == null)
            {
                return(password);
            }

            if (!ValidationMethods.IsPassword(password))
            {
                throw new ArgumentException($"Parameter:{ paramName}");
            }

            return(password);
        }