Example #1
0
        /// <summary>
        /// Gets a value that indicates whether this attribute is a match for the specified validation rule result.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This method is used to determine whether a class decorated with this attribute is eligible to be used to
        /// provide a message for the specified result.
        /// </para>
        /// </remarks>
        /// <param name="result">A validation rule result.</param>
        /// <returns><see langword="true" /> if this attribute matches the specified result; <see langword="false" /> otherwise.</returns>
        /// <exception cref="ArgumentNullException">If the <paramref name="result"/> is <see langword="null" />.</exception>
        public bool IsMatch(ValidationRuleResult result)
        {
            if (result is null)
            {
                throw new ArgumentNullException(nameof(result));
            }

            return(ValidationFunctions.All(func => func(result)));
        }