Exemplo n.º 1
0
        static void Main(string[] args)
        {
            ExchangeRateApi exchange  = new ExchangeRateApi();
            Converter       converter = new Converter(exchange);

            Console.WriteLine("List of Currencies:");
            foreach (string currency in exchange.GetAllCurrencies())
            {
                Console.WriteLine(currency);
            }
            Console.WriteLine("Enter From Currency :");
            string fromCurrency = Console.ReadLine();

            Console.WriteLine("Enter To Currency: ");
            string toCurrency = Console.ReadLine();

            Console.WriteLine("Enter Amount: ");
            int amount          = Convert.ToInt32(Console.ReadLine());
            var convertedAmount = converter.Convert(fromCurrency, toCurrency, amount);

            Console.WriteLine($"{amount} in {fromCurrency} converts to {convertedAmount} in {toCurrency}");
            Console.ReadLine();
        }
Exemplo n.º 2
0
 public void SetUp()
 {
     exchange = new ExchangeRateApi();
     json = "{ 'base':'GBP','date':'2015-09-02','rates':{ 'USD':1.5273,'EUR':1.357}}";
 }
Exemplo n.º 3
0
 public void SetUp()
 {
     exchange = new ExchangeRateApi();
     json     = "{ 'base':'GBP','date':'2015-09-02','rates':{ 'USD':1.5273,'EUR':1.357}}";
 }
Exemplo n.º 4
0
 public Exchange(ExchangeRateApi api)
 {
     this.api = api;
 }
Exemplo n.º 5
0
 public Exchange(ExchangeRateApi api)
 {
     this.api = api;
 }