Example #1
0
        public void Setup()
        {
            _worldBankClientMock  = new Mock <IWorldBankClient>();
            _countryCodeValidator = new CountryCodeValidator();

            _countryInfoService = new CountryInfoService(_countryCodeValidator, _worldBankClientMock.Object);
        }
        public CountryInfoService(ICountryCodeValidator countryCodeValidator, IWorldBankClient worldBankClient)
        {
            Ensure.IsNotNull(countryCodeValidator, nameof(countryCodeValidator));
            Ensure.IsNotNull(worldBankClient, nameof(worldBankClient));

            _countryCodeValidator = countryCodeValidator;
            _worldBankClient      = worldBankClient;
        }
Example #3
0
        /// <summary>
        ///     Constructor that permits to set all the validator.
        /// </summary>
        /// <param name="bankCodeValidator">
        ///     Objects that contains the rules to validate a Bank Code.
        /// </param>
        /// <param name="branchCodeValidator">
        ///     Objects that contains the rules to validate a Branch Code.
        /// </param>
        /// <param name="accountNumberValidator">
        ///     Objects that contains the rules to validate an Account Number.
        /// </param>
        /// <param name="countryCodeValidator">
        ///     Objects that contains the rules to validate a Country Code.
        /// </param>
        /// <param name="ibanValidator">
        ///     Objects that contains the rules to validate an IBAN.
        /// </param>
        /// <param name="bbanValidator">
        ///     Objects that contains the rules to validate a BBAN.
        /// </param>
        /// <exception cref="ValidatorException">
        ///     If any validator is not valid a <see cref="ValidatorException" /> will be thrown.
        /// </exception>
        public DefaultValidators(
            IBankCodeValidator bankCodeValidator,
            IBranchCodeValidator branchCodeValidator,
            IAccountNumberValidator accountNumberValidator,
            ICountryCodeValidator countryCodeValidator,
            IIbanValidator ibanValidator,
            IBbanValidator bbanValidator)
        {
            CheckNotNullArgument<IBankCodeValidator>(bankCodeValidator, "bankCodeValidator");
            CheckNotNullArgument<IBranchCodeValidator>(branchCodeValidator, "branchCodeValidator");
            CheckNotNullArgument<IAccountNumberValidator>(accountNumberValidator, "accountNumberValidator");
            CheckNotNullArgument<ICountryCodeValidator>(countryCodeValidator, "countryCodeValidator");
            CheckNotNullArgument<IIbanValidator>(ibanValidator, "ibanValidator");
            CheckNotNullArgument<IBbanValidator>(bbanValidator, "bbanValidator");

            _bankCodeValidator = bankCodeValidator;
            _branchCodeValidator = branchCodeValidator;
            _accountNumberValidator = accountNumberValidator;
            _countryCodeValidator = countryCodeValidator;
            _ibanValidator = ibanValidator;
            _bbanValidator = bbanValidator;
        }
Example #4
0
 public CountryCodeValidatorTest()
 {
     _contryCodeValidator = new CountryCodeValidator();
 }