Пример #1
0
        private ShouldAssertException CreateShouldAssertException(StudioXValidationException ave)
        {
            var message = "";

            foreach (var error in ave.ValidationErrors)
            {
                message += error.ErrorMessage + "\n";
            }

            return(new ShouldAssertException(message));
        }
        private string GetValidationErrorNarrative(StudioXValidationException validationException)
        {
            var detailBuilder = new StringBuilder();

            detailBuilder.AppendLine(L("ValidationNarrativeTitle"));

            foreach (var validationResult in validationException.ValidationErrors)
            {
                detailBuilder.AppendFormat(" - {0}", validationResult.ErrorMessage);
                detailBuilder.AppendLine();
            }

            return(detailBuilder.ToString());
        }
        private ValidationErrorInfo[] GetValidationErrorInfos(StudioXValidationException validationException)
        {
            var validationErrorInfos = new List <ValidationErrorInfo>();

            foreach (var validationResult in validationException.ValidationErrors)
            {
                var validationError = new ValidationErrorInfo(validationResult.ErrorMessage);

                if (validationResult.MemberNames != null && validationResult.MemberNames.Any())
                {
                    validationError.Members = validationResult.MemberNames.Select(m => m.ToCamelCase()).ToArray();
                }

                validationErrorInfos.Add(validationError);
            }

            return(validationErrorInfos.ToArray());
        }