Exemplo n.º 1
0
        private void Test(TProviderDefinition providerDefinition)
        {
            var result = _providerFactory.Test(providerDefinition);

            if (!result.IsValid)
            {
                throw new ValidationException(result.Errors);
            }
        }
Exemplo n.º 2
0
        public IActionResult TestAll()
        {
            var providerDefinitions = _providerFactory.All()
                                      .Where(c => c.Settings.Validate().IsValid&& c.Enable)
                                      .ToList();
            var result = new List <ProviderTestAllResult>();

            foreach (var definition in providerDefinitions)
            {
                var validationResult = _providerFactory.Test(definition);

                result.Add(new ProviderTestAllResult
                {
                    Id = definition.Id,
                    ValidationFailures = validationResult.Errors.ToList()
                });
            }

            return(result.Any(c => !c.IsValid) ? BadRequest(result) : Ok(result));
        }
Exemplo n.º 3
0
        private object TestAll()
        {
            var providerDefinitions = _providerFactory.All()
                                      .Where(c => c.Settings.Validate().IsValid&& c.Enable)
                                      .ToList();
            var result = new List <ProviderTestAllResult>();

            foreach (var definition in providerDefinitions)
            {
                var validationResult = _providerFactory.Test(definition);

                result.Add(new ProviderTestAllResult
                {
                    Id = definition.Id,
                    ValidationFailures = validationResult.Errors.ToList()
                });
            }

            return(ResponseWithCode(result, result.Any(c => !c.IsValid) ? HttpStatusCode.BadRequest : HttpStatusCode.OK));
        }
Exemplo n.º 4
0
        protected virtual void Test(TProviderDefinition definition, bool includeWarnings)
        {
            if (!definition.Enable)
            {
                return;
            }

            var validationResult = _providerFactory.Test(definition);

            VerifyValidationResult(validationResult, includeWarnings);
        }