Exemplo n.º 1
0
        public void GivenNumberToWords_UserEnters58586439587ReturnsLongStringOfNumber_String()
        {
            ToWords newWord  = new ToWords(58586439587);
            string  expected = "Fifty Eight Billion Five Hundred Eighty Six Million Four Hundred Thirty Nine Thousand Five Hundred Eighty Seven";
            string  actual   = newWord.EvaluateNumbersToWords(newWord._givenNumber);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void GivenNumberToWords_UserEnters1485643ReturnsLongStringOfNumber_String()
        {
            ToWords newWord  = new ToWords(1485643);
            string  expected = "One Million Four Hundred Eighty Five Thousand Six Hundred Fourty Three";
            string  actual   = newWord.EvaluateNumbersToWords(newWord._givenNumber);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void GivenNumberToWords_UserEnters85ReturnsEightyFive_EightyFive()
        {
            ToWords newWord  = new ToWords(85);
            string  expected = "Eighty Five";
            string  actual   = newWord.EvaluateNumbersToWords(newWord._givenNumber);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
        public void GivenNumberToWords_UserEnters11ReturnsEleven_Eleven()
        {
            ToWords newWord  = new ToWords(11);
            string  expected = "Eleven";
            string  actual   = newWord.EvaluateNumbersToWords(newWord._givenNumber);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 5
0
 private void btnConvert_Click(object sender, EventArgs e)
 {
     try
     {
         long num = long.Parse(txtNumber.Text);
         lblResult.Text = ToWords.ToString(num);
     }
     catch (ArgumentOutOfRangeException)
     {
         lblResult.Text = "لطفا عدد کوچکتری را وارد کنید";
     }
     catch (FormatException)
     {
         lblResult.Text = string.Empty;
     }
 }
Exemplo n.º 6
0
 private void btnConvert_Click(object sender, EventArgs e)
 {
     try
     {
         long num;
         if (long.TryParse(txtNumber.Text, out num))
         {
             lblResult.Text = ToWords.ToString(num);
         }
         else
         {
             lblResult.Text = "لطفا عدد کوچکتری را وارد کنید";
         }
     }
     catch (Exception)
     {
         lblResult.Text = "خطا";
     }
 }
Exemplo n.º 7
0
 private static string FormatNumber(double quantity)
 {
     return(CultureHelper.IsFarsiCulture ? ToWords.ToString(quantity) : quantity.ToString());
 }
 public void Can_Convert_Hundred_Thousands()
 {
     string s = ToWords.ToString(547230);
     Assert.NotNull(s);
 }
 public void Can_Convert_Ten_Thousands()
 {
     string s = ToWords.ToString(18910);
     Assert.NotNull(s);
 }
Exemplo n.º 10
0
 public void Can_Convert_Round_Numeric_Values(string converted, int toConvert)
 {
     Assert.AreEqual(converted, ToWords.ToString(toConvert));
 }
Exemplo n.º 11
0
 public void Can_Convert_Hundreds(string converted, int toConvert)
 {
     Assert.AreEqual(converted, ToWords.ToString(toConvert));
 }
Exemplo n.º 12
0
 public void Can_Convert_Singles()
 {
     string s = ToWords.ToString(8);
     Assert.NotNull(s);
 }
Exemplo n.º 13
0
 public void Should_Not_Be_Able_To_Convert_Minus_Values()
 {
     Assert.Throws<ArgumentOutOfRangeException>(() => ToWords.ToString(-1000));
 }
Exemplo n.º 14
0
 public void Should_Not_Be_Able_To_Convert_Larger_Than_Long_Values()
 {
     Assert.Throws<ArgumentOutOfRangeException>(() => ToWords.ToString(long.MaxValue));
 }
Exemplo n.º 15
0
 public void Should_Convert_Big_Integer_Values()
 {
     string s = ToWords.ToString(int.MaxValue);
     Assert.IsNotNullOrEmpty(s);
 }
Exemplo n.º 16
0
 public void Should_Convert_Maximum_Integer_Values()
 {
     ToWords.ToString(Int32.MaxValue);
 }