Пример #1
0
        private void btn_new_calc_Click(object sender, EventArgs e)
        {
            temp = adapter.Convert(Convert.ToDouble(txtb_new_amount.Text),
                                   combob_new_from.SelectedItem.ToString(),
                                   combob_new_to.SelectedItem.ToString());

            txtb_new_result.Text = temp.ToString();
        }
        public void HundredRubToUSDConvertingTest()
        {
            ICurrencyConverter currConverter     = new CurrenciesConverter();
            ICurrenciesFactory currenciesFactory = new CurrenciesFactory();

            decimal rubRate = 90.0681M;
            decimal usdRate = 1.2219M;

            ICurrency rubles  = currenciesFactory.GetCurrency(CurrencyConverter.BL.Enums.ECurrencyCodes.RUB.ToString(), rubRate);
            ICurrency dollars = currenciesFactory.GetCurrency(CurrencyConverter.BL.Enums.ECurrencyCodes.USD.ToString(), usdRate);

            decimal resultAmountOfDollars = currConverter.Convert(rubles, dollars, 100M);

            Assert.Equal(1.3566M, decimal.Round(resultAmountOfDollars, 4));
        }