public ConverterService( ICurrencyRateService currencyRateService, IGlobalCurrencyRateService globalCurrencyRateService) { _currencyRateService = currencyRateService; _globalCurrencyRateService = globalCurrencyRateService; }
public CurrencyRatesController( ICurrencyRateService currencyRateService, IMapper mapper) { _currencyRateService = currencyRateService; _mapper = mapper; }
public void CannotConvertRubToUse() { var sourceAccount = new MemberAccount { Balance = 10, }; var targetAccount = new MemberAccount { Balance = 10, }; var unitOfWork = new Mock <IUnitOfWork>(); var memberAccountRepo = new Mock <IMemberAccountReposotory>(); var rateRepo = new Mock <ICurrencyRateRepoository>(); rateRepo.Setup(a => a.GetBy(It.IsAny <string>())).Returns <string>((x) => { return(new CurrencyRate { Rate = x == "rub" ? 80 : 0.9m, }); }); memberAccountRepo.Setup(a => a.GetByUser(It.IsAny <int>(), It.IsAny <string>())).Returns <int, string>((x, y) => { return(y == "rub" ? sourceAccount : targetAccount); }); unitOfWork.SetupGet(x => x.MemberAccounts).Returns(memberAccountRepo.Object); unitOfWork.SetupGet(x => x.CurrencyRates).Returns(rateRepo.Object); _target = new CurrencyConverterService(unitOfWork.Object); Assert.Catch <InvalidOperationException>(() => _target.Convert(new CurrencyConverClaim { From = "rub", To = "Usd", Amount = 100, UserId = 1 })); }
public SetCurrencyRatesJob(ICurrencyRateFactory currencyRateFactory, ICurrencyRateService currencyRateService) { Requires.NotNull(currencyRateFactory, "currencyRateFactory"); Requires.NotNull(currencyRateService, "currencyRateService"); _currencyRateFactory = currencyRateFactory; _currencyRateService = currencyRateService; }
public IndexModel(ICurrencyRateService currencyRateService, IConfiguration configuration, LogRepository logRepository) { _currencyRateService = currencyRateService; _configuration = configuration; _logRepository = logRepository; CurrenciesSelected = configuration.GetSection("CurrenciesSelected:Currencies").Get <List <string> >(); _currencyDefault = configuration.GetSection("CurrenciesSelected:DefaultCurrency").Get <string>(); }
public AccountService(IAccountDataAccess accountDataAccess, ICurrencyRateService currencyRateService, IAccountMapper accountMapper) { this.accountDataAccess = accountDataAccess ?? throw new ArgumentNullException("accountDataAccess is null"); this.currencyRateService = currencyRateService ?? throw new ArgumentNullException("currencyRateService is null"); this.accountMapper = accountMapper ?? throw new ArgumentNullException("accountMapper is null"); }
public CurrencyRatesDownloadService(ITradingDataService tradingDataService, ICurrencyRateService currencyRateService, IHttpClientFactory httpClientFactory, int?delay) { this.tradingDataService = tradingDataService; this.currencyRateService = currencyRateService; this.httpClientFactory = httpClientFactory; this.delay = delay; }
public IpInfoService(ICache cache, IAPIRequestCreator apiRequestCreator, ICountryService countryService, ICurrencyRateService currencyRateService) { _cache = cache; _apiRequestCreator = apiRequestCreator; _countryService = countryService; _currencyRateService = currencyRateService; }
public MarkupService(IMarkupPolicyService markupPolicyService, IDiscountFunctionService discountFunctionService, IMarkupPolicyTemplateService templateService, ICurrencyRateService currencyRateService, IMemoryFlow flow) { _markupPolicyService = markupPolicyService; _discountFunctionService = discountFunctionService; _templateService = templateService; _currencyRateService = currencyRateService; _flow = flow; }
public AbstractCurrencyRateController( ApiSettings settings, ILogger <AbstractCurrencyRateController> logger, ITransactionCoordinator transactionCoordinator, ICurrencyRateService currencyRateService, IApiCurrencyRateModelMapper currencyRateModelMapper ) : base(settings, logger, transactionCoordinator) { this.CurrencyRateService = currencyRateService; this.CurrencyRateModelMapper = currencyRateModelMapper; }
public MarkupService(EdoContext context, IDoubleFlow flow, IMarkupPolicyTemplateService templateService, ICurrencyRateService currencyRateService, IAgentSettingsManager agentSettingsManager, IAccommodationBookingSettingsService accommodationBookingSettingsService) { _context = context; _flow = flow; _templateService = templateService; _currencyRateService = currencyRateService; _agentSettingsManager = agentSettingsManager; _accommodationBookingSettingsService = accommodationBookingSettingsService; }
public ValuationService(IEndOfDayPriceService endOfDayPriceService, ICurrencyRateService currencyRateService, IListingService listingService, IValuationRepository valuationRepository, IBuyTradeRepository buyTradeRepository, ISellTradeRepository sellTradeRepository, ILogger <ValuationService> logger ) { this.endOfDayPriceService = endOfDayPriceService; this.currencyRateService = currencyRateService; this.listingService = listingService; this.valuationRepository = valuationRepository; this.buyTradeRepository = buyTradeRepository; this.sellTradeRepository = sellTradeRepository; _logger = logger; }
public CurrencyRateController( ApiSettings settings, ILogger <CurrencyRateController> logger, ITransactionCoordinator transactionCoordinator, ICurrencyRateService currencyRateService, IApiCurrencyRateModelMapper currencyRateModelMapper ) : base(settings, logger, transactionCoordinator, currencyRateService, currencyRateModelMapper) { this.BulkInsertLimit = 250; this.MaxLimit = 1000; this.DefaultLimit = 250; }
public async Task <BaseResponse <List <ExchangeDto> > > Convert(decimal sum, string date) { _logger.LogInformation($"ConvertSum is invoked."); try { if (!DateTime.TryParseExact(date, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out DateTime dateValue)) { throw new ArgumentException($"Параметр '{nameof(date)}' не содержит дату. Значение параметра: '{date}'", nameof(date)); } List <ExchangeDto> result = new List <ExchangeDto>(); foreach (var currency in _currencies) { ExchangeDto exchangeDto = new ExchangeDto() { CurrencyCode = currency.Code, CurrencyTitle = currency.Title, }; result.Add(exchangeDto); try { ICurrencyRateService service = _currencyServices[currency.ServiceName]; decimal convertedSum = await service.ConvertSum(sum, dateValue); exchangeDto.Sum = convertedSum; } catch (Exception ex) { _logger.LogError(ex.ToString()); exchangeDto.IsSuccess = false; exchangeDto.Error = ex.Message; } } return(new BaseResponse <List <ExchangeDto> >(result)); } catch (Exception ex) { _logger.LogError(ex.ToString()); return(new BaseResponse <List <ExchangeDto> >(ex)); } }
public void CanConvertRubToUse() { var sourceAccount = new MemberAccount { Balance = 1000, }; var targetAccount = new MemberAccount { Balance = 10, }; var unitOfWork = new Mock <IUnitOfWork>(); var memberAccountRepo = new Mock <IMemberAccountReposotory>(); var rateRepo = new Mock <ICurrencyRateRepoository>(); rateRepo.Setup(a => a.GetBy(It.IsAny <string>())).Returns <string>((x) => { return(new CurrencyRate { Rate = x == "rub" ? 80 : 0.9m, }); }); memberAccountRepo.Setup(a => a.GetByUser(It.IsAny <int>(), It.IsAny <string>())).Returns <int, string>((x, y) => { return(y == "rub" ? sourceAccount : targetAccount); }); unitOfWork.SetupGet(x => x.MemberAccounts).Returns(memberAccountRepo.Object); unitOfWork.SetupGet(x => x.CurrencyRates).Returns(rateRepo.Object); _target = new CurrencyConverterService(unitOfWork.Object); _target.Convert(new CurrencyConverClaim { From = "rub", To = "Usd", Amount = 100, UserId = 1 }); var calculeted = _target.CalculateConvert("rub", "use", 100); Assert.AreEqual(sourceAccount.Balance, 900); Assert.AreEqual(targetAccount.Balance, 11.125); Assert.AreEqual(calculeted, 1.125); }
public PriceList GetPrice(ICurrencyRateService rateService) { var list = new PriceList(); foreach (var r in Rides) { var currencyRate = rateService.GetRate(CurrencyUnit.EUR, r.UnitPrice.CurrencyUnit, r.Start); var currencyItem = new CurrencyItem(CurrencyUnit.EUR, r.UnitPrice.CurrencyUnit, currencyRate); var distanceItem = new LogisticItem(r.Distance, r.DistanceUnit, Rounding.HalfToEven); var itemPrice = new ItemPrice(r.UnitPrice, distanceItem, currencyItem) { Description = $"Ride from {r.From} to {r.To}." }; list.Add(itemPrice); } var total = list.Sum(); total.Description = $"Total."; list.Add(total); return(list); }
public CurrencyConversionService(ICurrencyRateService currencyRateService) { this._currencyRateService = currencyRateService; }
public RatesController(ICurrencyRateService currencyRateService) { _currencyRateService = currencyRateService; }
public CurrencyConverterService(ICurrencyRateService rateService, ICurrencyConverterFactory converterFactory) { _converterFactory = converterFactory; _rateService = rateService; }
public CurrencyRatesController(ILogger logger, IUnitOfWork unitOfWork, ICurrencyRateService currencyRateService) : base(logger, unitOfWork) { Requires.NotNull(currencyRateService, "currencyRateService"); _currencyRateService = currencyRateService; }
/// <summary> /// Контроллер курсов валюты. /// </summary> /// <param name="currencyRateService">Сервис курсов валюты.</param> public CurrencyRateController(ICurrencyRateService currencyRateService) { this.CurrencyRateService = currencyRateService; }
public GetConversionRateQueryHandler(ICurrencyRateService currencyRateClient, IDateTimeProvider dateTimeProvider) { _currencyRateClient = currencyRateClient; _dateTimeProvider = dateTimeProvider; }
public HomeController( ICurrencyRateService currencyRateService) { _currencyRateService = currencyRateService ?? throw new ArgumentException(nameof(currencyRateService)); }
public CurrencyRateTest() { currencyService = new CurrencyService(); currencyRateService = new CurrenyRateService(); }
public ConverterController(ICurrencyRateService currencyRateService) { _currencyRateService = currencyRateService; }
public CurrencyRatesController(ICurrencyRateService srv, IUnitOfWork unitOfWork) { this._srv = srv; this._unitOfWork = unitOfWork; }
/// <summary> /// Initialize a new instance of the <see cref="CurrencyRateController"/>. /// </summary> /// <param name="logger">The logger.</param> /// <param name="currencyRateService">CurrencyRateService</param> public CurrencyRateController(ILogger <CurrencyRateController> logger, ICurrencyRateService currencyRateService) { this.logger = logger; this.currencyRateService = currencyRateService; }
public ExchangeService(ICurrencyRateService currencyRateService) { _currencyRateService = currencyRateService; }
public CurrenciesRateJob(ICurrencyRateService currencyRateService) { Requires.NotNull(currencyRateService); _currencyRateService = currencyRateService; }
public CurrencyRatesController(ApiServices services, IUnitOfWork unitOfWork, ICurrencyRateService currencyRateService) : base(services, unitOfWork) { Requires.NotNull(currencyRateService, "currencyRateService"); _currencyRateService = currencyRateService; }
public ExchangeMoneyService(IUnitOfWork unitOfWork, ILogger logger, ICurrencyRateService currencyRateService) : base(unitOfWork, logger) { Requires.NotNull(currencyRateService, "currencyRateService"); _currencyRateService = currencyRateService; }
public InvestmentController(IChartService chartService, ICurrencyRateService currencyRateService) { _chartService = chartService ?? throw new ArgumentException(nameof(chartService)); _currencyRateService = currencyRateService ?? throw new ArgumentException(nameof(currencyRateService)); }
public CurrencyRateServiceTest() { _rateService = new CurrencyRateService(new RepositoryFactoryMoq()); }
public CurrencyRateController(ICurrencyRateService currencyrateService) { _CurrencyRateService = currencyrateService; }