Exemplo n.º 1
0
        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
                );
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public void ShouldReturnSameAmountWhenCurrenciesMatch(string from, string to, decimal fromAmount)
        {
            var service = new DefaultExchangeService();

            Assert.Equal(fromAmount, service.GetAmount(from, to, fromAmount));
        }