Ejemplo n.º 1
0
        public ApiValidatedResult <T> ToFailedValidatedResult <T>()
        {
            if (Success)
            {
                throw new InvalidOperationException(
                          "This method should only be called on a ValidationResult instance that contains errors. " +
                          "Consider checking the state using IsValid property before calling this method.");
            }

            return(ApiValidatedResult <T> .Failure(Errors));
        }
        public new static ApiValidatedResult <T> Aggregate(params ApiValidationResult[] results)
        {
            if (results == null)
            {
                return(Ok());
            }

            var result = new ApiValidatedResult <T>();

            results.SafeForEach(r => result.Append(r));

            return(result);
        }
        public new static ApiValidatedResult <T> Aggregate(params ApiValidationError[] errors)
        {
            if (errors == null)
            {
                return(Ok());
            }

            var result = new ApiValidatedResult <T>();

            errors.SafeForEach(e => result.Append(e));

            return(result);
        }