예제 #1
0
        public void Get_currencyconversion_converterlayer_ThrowArgumentException(string from, string to, decimal amount)
        {
            var mock       = new Mock <ICurrencyConverterService>();
            var controller = new ConverterController(mock.Object);

            Assert.Throws <ArgumentException>(() => controller.CurrencyConversion(from, to, amount));
        }
예제 #2
0
        public void Get_currencyconversion_converterlayer_success(string from, string to, decimal amount, decimal currency, decimal resultExpected)
        {
            var mock = new Mock <ICurrencyConverterService>();

            mock.Setup(x => x.GetCurrency(from, to))
            .Returns(currency);

            var currencyController = new ConverterController(mock.Object);
            var result             = currencyController.CurrencyConversion(from, to, amount);

            Assert.Equal(resultExpected, result);
        }