public void SetUp()
 {
     _target = new AllOptionsValidator();
     _data   = new AllOptions
     {
         General = new GeneralOptions
         {
             MaxAmount            = 10_000_000,
             AmountPrecision      = 2,
             CoefficientPrecision = 2
         },
Exemplo n.º 2
0
        private bool ValidateInput()
        {
            AllOptionsValidator validator        = new AllOptionsValidator();
            ValidationResult    validationResult = validator.Validate(_options);

            if (!validationResult.IsValid)
            {
                _logger.LogCritical("Invalid configuration. There are {0} error(s):{1}{2}",
                                    validationResult.Errors.Count, Environment.NewLine, validationResult);
            }
            else
            {
                _logger.LogInformation("Configuration is valid according to the defined rules.");
            }

            return(validationResult.IsValid);
        }