Пример #1
0
        private static void Main(string[] args)
        {
            while (true)
            {
                Console.Write("Amount (GBP) : ");
                var amount = Convert.ToDouble(Console.ReadLine());

                Console.Write("CountryCode (USD,EUR,JPY) : ");
                var country = Console.ReadLine();

                var currencyConverter = new CurrencyConversion(new CurrencyConversion.RatesAndChargesRepository());

                if (currencyConverter.CanConvert(amount))
                {
                    var result = currencyConverter.DoConversion(amount, country);

                    Console.WriteLine("Amount : " + result.Result + " " + country);
                    Console.WriteLine("Fee (GBP) = " + result.Fee);
                    Console.WriteLine("Total (GBP) = " + result.Total);
                }
                else
                {
                    Console.WriteLine("Amount exceeds max limit");
                }

                Console.Write("Continue  ? y/n : ");

                if (Console.ReadLine() == "n")
                {
                    return;
                }

                Console.WriteLine();
            }
        }
Пример #2
0
        public void CannotConvertOverLimit()
        {
            var currencyConverter = new Converter.CurrencyConversion(null);

            var result = currencyConverter.CanConvert(10001);

            Assert.IsFalse(result);
        }
Пример #3
0
        public void CanConvertUnderLimit()
        {
            var currencyConverter = new Converter.CurrencyConversion(null);

            var result = currencyConverter.CanConvert(999);

            Assert.IsTrue(result);
        }