Пример #1
0
        /// <inheritdoc/>
        public override CurrencyQuotationDTO RunService(string currencyCode)
        {
            _currencyCode = currencyCode;
            Guard.Against.NullOrEmpty(currencyCode, nameof(currencyCode));

            if (_currencyCode == Enum.GetName(typeof(SupportedCurrenciesCodes), SupportedCurrenciesCodes.BRL_ARS))
            {
                var USD_ARSCode = Enum.GetName(typeof(SupportedCurrenciesCodes), SupportedCurrenciesCodes.USD_ARS);
                Guard.Against.NullOrEmpty(currencyCode, nameof(USD_ARSCode));

                _sourceURL = _supportedCurrencies.GetCurrencyUrl(USD_ARSCode);
                Guard.Against.NullOrEmpty(_sourceURL, nameof(_sourceURL));
                Guard.Against.InvalidFormat(_sourceURL, nameof(_sourceURL), Regexs.URLRegex);

                var quotationWithURL = _serviceFactory.MakeService <CurrencyQuotationDTO>(nameof(QuotationWithURLService));
                var USD_ARSQuotation = quotationWithURL.RunService(USD_ARSCode) as CurrencyQuotationDTO;

                var resutl = GetCurrencyQuotationBaseOnOther(USD_ARSQuotation);
                return(resutl);
            }
            else
            {
                throw new ArgumentException("The currency code provided is not supported for this service.");
            }
        }
Пример #2
0
        /// <inheritdoc/>
        public override CurrencyQuotationDTO RunService(string currencyCode)
        {
            _currencyCode = currencyCode;
            Guard.Against.NullOrEmpty(_currencyCode, nameof(_currencyCode));

            _sourceURL = _supportedCurrencies.GetCurrencyUrl(_currencyCode);
            Guard.Against.NullOrEmpty(_sourceURL, nameof(_sourceURL));
            Guard.Against.InvalidFormat(_sourceURL, nameof(_sourceURL), Regexs.URLRegex);

            var result = GetCurrencyQuotationWithURL();

            return(result);
        }