Esempio n. 1
0
        public void ShouldThrowArgumentOfRangeWhenCurrencyDoesntExists(string sourceCurrencySymbol, string destinationCurrencySymbol)
        {
            IBankServiceProxy bankServiceProxyMock = Mock.Create <IBankServiceProxy>();

            Mock.Arrange(() => bankServiceProxyMock.GetCurrencies()).Returns(currencies);

            CurrencyService currencyService = new CurrencyService(bankServiceProxyMock);

            currencyService.Exchange(sourceCurrencySymbol, destinationCurrencySymbol, 100);
        }
Esempio n. 2
0
        public void ShouldExchangeAmountBetweenCurrencies(string sourceCurrencySymbol, string destinationCurrencySymbol, decimal amount, decimal expectedAmount)
        {
            IBankServiceProxy bankServiceProxyMock = Mock.Create <IBankServiceProxy>();

            Mock.Arrange(() => bankServiceProxyMock.GetCurrencies()).Returns(currencies);

            CurrencyService currencyService     = new CurrencyService(bankServiceProxyMock);
            decimal         amountAfterExchange = currencyService.Exchange(sourceCurrencySymbol, destinationCurrencySymbol, amount);

            Assert.AreEqual(expectedAmount, amountAfterExchange);
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CurrencyService" /> class.
 /// </summary>
 /// <param name="bankServiceProxy">The bank service proxy.</param>
 public CurrencyService(IBankServiceProxy bankServiceProxy)
 {
     this.bankServiceProxy = bankServiceProxy;
 }