Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IbanValidator" /> class with specified options.
 /// </summary>
 /// <param name="options">The validator options.</param>
 public IbanValidator(IbanValidatorOptions options)
     : this(
         options ?? throw new ArgumentNullException(nameof(options)),
         new DefaultValidationRuleResolver(options)
         )
 {
 }
Пример #2
0
            public void It_should_set_property()
            {
                var opts = new IbanValidatorOptions();

                // Act
                var validator = new IbanValidator(opts);

                // Assert
                validator.Options.Should().BeSameAs(opts);
            }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IbanValidator" /> class with specified options.
        /// </summary>
        /// <param name="options">The validator options.</param>
        /// <param name="validationRuleResolver">The validation rule resolver.</param>
        // ReSharper disable once MemberCanBePrivate.Global
        internal IbanValidator(IbanValidatorOptions options, IValidationRuleResolver validationRuleResolver)
        {
            Options = options ?? throw new ArgumentNullException(nameof(options));
            if (validationRuleResolver is null)
            {
                throw new ArgumentNullException(nameof(validationRuleResolver));
            }

            if (options.Registry is null)
            {
                throw new ArgumentException(Resources.ArgumentException_Registry_is_required, nameof(options));
            }

            SupportedCountries = options.Registry;
            _rules             = validationRuleResolver.GetRules().ToList();
        }
Пример #4
0
 public IbanValidatorOptionsTests()
 {
     _sut = new IbanValidatorOptions();
 }