Пример #1
0
 public ValidationResult(IEnumerable <GatewayAutomationResult> errors)
 {
     this.IsError = true;
     this.Errors  = errors;
     this.ValidatePublishingResult = ValidatePublishingResult.Empty();
 }
Пример #2
0
        private static IEnumerable <GatewayAutomationResult> GetValidatePublishingErrors(ValidatePublishingResult validatePublishingResult)
        {
            var results = new List <GatewayAutomationResult>();

            foreach (var api in validatePublishingResult.Apis)
            {
                if (api.Errors.Any())
                {
                    results.Add(new GatewayAutomationResult
                    {
                        ResultCode = ResultCode.ValidationFailed,
                        Message    = $"[API] {api.Name}, {api.Path}/{api.Version}: {string.Join(", ", api.Errors)}",
                        IsError    = true,
                    });
                }

                foreach (var rev in api.Revisions)
                {
                    if (rev.Errors.Any())
                    {
                        results.Add(new GatewayAutomationResult
                        {
                            ResultCode = ResultCode.ValidationFailed,
                            Message    = $"[API Revision] {api.Name}, {api.Path}/{api.Version}: {string.Join(", ", rev.Errors)}",
                            IsError    = true,
                        });
                    }
                }
            }

            foreach (var product in validatePublishingResult.Products)
            {
                if (product.Errors.Any())
                {
                    results.Add(new GatewayAutomationResult
                    {
                        ResultCode = ResultCode.ValidationFailed,
                        Message    = $"[Product] {product.Name}: {string.Join(", ", product.Errors)}",
                        IsError    = true,
                    });
                }
            }

            return(results);
        }
Пример #3
0
 public ValidationResult(ValidatePublishingResult validatePublishingResult)
 {
     this.IsError = false;
     this.Errors  = Enumerable.Empty <GatewayAutomationResult>();
     this.ValidatePublishingResult = validatePublishingResult;
 }