Ejemplo n.º 1
0
        public void AssertIsValid()
        {
            var reports = _reports.Where(x => x.HasAnyErrors()).ToArray();
            if (reports.Any())
            {
                var errorCount = reports.Sum(x => x.Errors.Count());
                var validationCount = reports.Sum(x => x.Validations.Count());
                var title =
                    "StructureMap Failures:  {0} Build/Configuration Failures and {1} Validation Errors".ToFormat(
                        errorCount, validationCount);

                var writer = new StringWriter();
                reports.Each(x => x.WriteErrorMessages(writer));

                var ex = new StructureMapConfigurationException(title) {Context = writer.ToString()};

                throw ex;
            }
        }
        public void AssertIsValid()
        {
            var reports = _reports.Where(x => x.HasAnyErrors()).ToArray();

            if (reports.Any())
            {
                var errorCount      = reports.Sum(x => x.Errors.Count());
                var validationCount = reports.Sum(x => x.Validations.Count());
                var title           =
                    "StructureMap Failures:  {0} Build/Configuration Failures and {1} Validation Errors".ToFormat(
                        errorCount, validationCount);

                var writer = new StringWriter();
                reports.Each(x => x.WriteErrorMessages(writer));

                var ex = new StructureMapConfigurationException(title)
                {
                    Context = writer.ToString()
                };

                throw ex;
            }
        }