Exemplo n.º 1
0
        public ExchangeRateCalculatorTests()
        {
            _ratesCache = new Mock <ICacheExchangeRates>();
            _calculator = new ExchangeRateCalculator(_ratesCache.Object);

            var eurExchangeRate = new Dictionary <Currency, decimal>
            {
                { Currency.EUR, 1m },
                { Currency.GBP, TargetEurGbpRate },
                { Currency.USD, TargetEurUsdRate }
            };
            var gbpExchangeRate = new Dictionary <Currency, decimal>
            {
                { Currency.GBP, 1m },
                { Currency.EUR, TargetGbpEurRate },
                { Currency.USD, TargetGbpUsdRate }
            };
            var usdExchangeRate = new Dictionary <Currency, decimal>
            {
                { Currency.USD, 1m },
                { Currency.GBP, TargetUsdGbpRate },
                { Currency.EUR, TargetUsdEurRate }
            };

            _exchangeRates = new Dictionary <Currency, IReadOnlyDictionary <Currency, decimal> >
            {
                { Currency.EUR, eurExchangeRate },
                { Currency.GBP, gbpExchangeRate },
                { Currency.USD, usdExchangeRate }
            };
        }
Exemplo n.º 2
0
 public ExchangeController(IBuildExchangeRequests exchangeRequestBuilder, ICalculateExchangeRates calculator)
 {
     _exchangeRequestBuilder = exchangeRequestBuilder;
     _calculator             = calculator;
 }