public void ShouldCalculateWHenDkkUsed(string from, string to, decimal fromAmount, decimal expected) { var service = new DefaultExchangeService(); decimal delta = expected * 0.05m; Assert.InRange( service.GetAmount(from, to, fromAmount), expected - delta, expected + delta ); }
public void ShouldErrorWhenUnknownCurrency() { var service = new DefaultExchangeService(); var result = Assert.Throws <InvalidCurrencyException>( () => service.GetAmount("AAA", "USD", 1) ); Assert.Equal("AAA", result.InvalidValue); result = Assert.Throws <InvalidCurrencyException>( () => service.GetAmount("USD", "BBB", 1) ); Assert.Equal("BBB", result.InvalidValue); }
public void ShouldReturnSameAmountWhenCurrenciesMatch(string from, string to, decimal fromAmount) { var service = new DefaultExchangeService(); Assert.Equal(fromAmount, service.GetAmount(from, to, fromAmount)); }