public decimal CalculatePriceInTheMainCurrency(int currencyIdOfThePrice, decimal price, DateTime date) { Currency mainCurrency = _currenciesRepository.GetMainCurrency(); if (currencyIdOfThePrice == mainCurrency.Id) { return(price); } CurrencyRate currencyRate = _currencyRatesRepository.GetActualRate(currencyIdOfThePrice, date); return(currencyRate.Rate * price); }
public void GetActualRate_2() { //Arrange ResetDataBase(); DateTime date = DateTime.Now; ICurrencyRatesRepository currencyRatesRepository = DI.Resolve <ICurrencyRatesRepository>(); //Act CurrencyRate currencyRate = currencyRatesRepository.GetActualRate(3, date); //Asserts Assert.That(currencyRate.Id, Is.EqualTo(1)); }