public void Validate_ConvertToEnglishCurrency_NegativeNumber()
        {
            string            input             = "-351";
            CurrencyConverter currencyConverter = new CurrencyConverter();

            string result = currencyConverter.ConvertToEnglishCurrency(input);
        }
        public void Validate_ConvertToEnglishCurrency_148Dollar68Cents()
        {
            string            input             = "148.68";
            CurrencyConverter currencyConverter = new CurrencyConverter();

            string result = currencyConverter.ConvertToEnglishCurrency(input);

            Assert.AreEqual("One Hundred Forty Eight Dollars and Sixty Eight Cents", result);
        }
        public void Validate_ConvertToEnglishCurrency_OneDollar15Cents()
        {
            string            input             = "1.15";
            CurrencyConverter currencyConverter = new CurrencyConverter();

            string result = currencyConverter.ConvertToEnglishCurrency(input);

            Assert.AreEqual("One Dollar and Fifteen Cents", result);
        }
        public void Validate_ConvertToEnglishCurrency_999Trillion()
        {
            string            input             = "999,000,000,000,000.05";
            CurrencyConverter currencyConverter = new CurrencyConverter();

            string result = currencyConverter.ConvertToEnglishCurrency(input);

            Assert.AreEqual("Nine Hundred Ninety Nine Trillion Dollars and Five Cents", result);
        }
        public void Validate_ConvertToEnglishCurrency_17Trillion()
        {
            string            input             = "17000000000000.05";
            CurrencyConverter currencyConverter = new CurrencyConverter();

            string result = currencyConverter.ConvertToEnglishCurrency(input);

            Assert.AreEqual("Seventeen Trillion Dollars and Five Cents", result);
        }
        public void Validate_ConvertToEnglishCurrency_5Cents()
        {
            string            input             = "00.05";
            CurrencyConverter currencyConverter = new CurrencyConverter();

            string result = currencyConverter.ConvertToEnglishCurrency(input);

            Assert.AreEqual("Five Cents", result);
        }
        public void Validate_ConvertToEnglishCurrency_1058_01()
        {
            string            input             = "1058.01";
            CurrencyConverter currencyConverter = new CurrencyConverter();

            string result = currencyConverter.ConvertToEnglishCurrency(input);

            Assert.AreEqual("One Thousand Fifty Eight Dollars and One Cent", result);
        }
Пример #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Amount to English Currency Converter");
            CurrencyConverter currencyConverter = new CurrencyConverter();

            while (true)
            {
                Console.WriteLine("Please enter the amount to be converted");
                string input = Console.ReadLine();
                try
                {
                    Console.WriteLine(currencyConverter.ConvertToEnglishCurrency(input));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                Console.WriteLine();
                Console.WriteLine();
            }
        }