public void CheckOneDollar()
        {
            var    converter = new AmountToWords();
            string result    = converter.ChangeAmountToWords(1);

            Assert.AreEqual("ONE DOLLAR", result);
        }
        public void CheckOneDollarOneCent()
        {
            var    converter = new AmountToWords();
            string result    = converter.ChangeAmountToWords(1.01);

            Assert.AreEqual("ONE DOLLAR AND ONE CENT", result);
        }
示例#3
0
        public ActionResult GetCheckDetails(int id)
        {
            using (var client = new HttpClient())
            {
                string baseAddress = ConfigurationManager.AppSettings["BaseAddress"];
                client.BaseAddress = new Uri(baseAddress);

                HttpResponseMessage response = client.GetAsync(string.Format("api/GetCheque/{0}", id)).Result;
                if (!response.IsSuccessStatusCode) // Error Exist
                {
                    var errorMesage = string.Format("Error Status Code: {0}, Error Message: {1}", (int)response.StatusCode,
                                                    response.Content.ReadAsStringAsync().Result);
                    throw new Exception(errorMesage);
                }

                var converter = new AmountToWords();
                var cheque    = response.Content.ReadAsAsync <Cheque>().Result;

                var model = new ChequeDetailsViewModel(cheque)
                {
                    Pay = converter.ChangeAmountToWords(cheque.Amount)
                };

                return(this.View("Details", model));
            }
        }
        public void Check_12345678Dollars_99Cents()
        {
            var    converter = new AmountToWords();
            string result    = converter.ChangeAmountToWords(12345678.99);
            string expected  = "TWELVE MILLION THREE HUNDRED FOURTY FIVE THOUSAND SIX HUNDRED SEVENTY EIGHT DOLLARS AND NINETY NINE CENTS";

            Assert.AreEqual(expected, result);
        }
        public void Check_1217Dollars_5Cents()
        {
            var    converter = new AmountToWords();
            string result    = converter.ChangeAmountToWords(1217.05);
            string expected  = "ONE THOUSAND TWO HUNDRED SEVENTEEN DOLLARS AND FIVE CENTS";

            Assert.AreEqual(expected, result);
        }