Esempio n. 1
0
        public void TestGetExchangeRate()
        {
            var stockExchange = new StockExchange();

            stockExchange.AddExchangeRate(StockExchange.ExchangeRate(DateTime.Now, "CHF", "USD", 2.0M));
            stockExchange.AddExchangeRate(StockExchange.ExchangeRate(DateTime.Now.AddMilliseconds(1d), "CHF", "USD", 2.1M));
            var bank = new Bank(stockExchange, new MockUpCurrencyListing(), "USD");

            var currentRate = stockExchange.GetExchangeRate("CHF", "USD");

            Assert.AreEqual(currentRate.ConversionRate, 2.1M);
            Assert.AreEqual(bank.GetInternalExchangeRate("CHF"), currentRate);
            Assert.AreEqual(stockExchange.GetExchangeRate("CHF", "CAD"), null);
        }