Example #1
0
        public void TestGetExchangeRate()
        {
            Currency cur = new Currency();

            cur.id   = 1;
            cur.name = "usd";
            ExchangeCurrency exc  = new ExchangeCurrency();
            double           rate = exc.getExchangeRate(cur);

            Assert.AreEqual(0.742164, rate);
        }
Example #2
0
        public void TestGetExchangeRate()
        {
            Currency cur = new Currency();

            cur.id   = 1;
            cur.name = "usd";
            ExchangeCurrency exc  = new ExchangeCurrency();
            decimal          rate = exc.getExchangeRate(cur);

            Assert.AreEqual(1.3574, rate);
        }
        // GET: ExchangeCurrency
        public decimal GetExchangeAmount(Currency curr)
        {
            ExchangeCurrency exc = new ExchangeCurrency();

            decimal amount = 0;

            if (exc.getExchangeRate(curr) == 0)
            {
            }
            else
            {
                amount = (int)exc.getExchangedAmount(curr);
            }

            return(amount);
        }
        public string GetRecommendationExchange(Currency curr)
        {
            string res = "";

            ExchangeCurrency exc = new ExchangeCurrency();
            decimal          dec = exc.getExchangedAmount(curr);

            // get the nearest hundreds
            int decint = (int)dec;

            int rounded = ((decint + 99) / 100) * 100;

            decimal rate = exc.getExchangeRate(curr);

            decimal res1 = rounded * rate;

            res = "recommeded to get " + curr.name.ToUpper() + rounded + " by exchanging: SGD" + (int)res1;

            return(res);
        }
        public decimal GetExchangeRate(Currency curr)
        {
            ExchangeCurrency exc = new ExchangeCurrency();

            return(exc.getExchangeRate(curr));
        }