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); }
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); }
public void GivenNumberToWords_UserEnters85ReturnsEightyFive_EightyFive() { ToWords newWord = new ToWords(85); string expected = "Eighty Five"; string actual = newWord.EvaluateNumbersToWords(newWord._givenNumber); Assert.AreEqual(expected, actual); }
public void GivenNumberToWords_UserEnters11ReturnsEleven_Eleven() { ToWords newWord = new ToWords(11); string expected = "Eleven"; string actual = newWord.EvaluateNumbersToWords(newWord._givenNumber); Assert.AreEqual(expected, actual); }
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; } }
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 = "خطا"; } }
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); }
public void Can_Convert_Round_Numeric_Values(string converted, int toConvert) { Assert.AreEqual(converted, ToWords.ToString(toConvert)); }
public void Can_Convert_Hundreds(string converted, int toConvert) { Assert.AreEqual(converted, ToWords.ToString(toConvert)); }
public void Can_Convert_Singles() { string s = ToWords.ToString(8); Assert.NotNull(s); }
public void Should_Not_Be_Able_To_Convert_Minus_Values() { Assert.Throws<ArgumentOutOfRangeException>(() => ToWords.ToString(-1000)); }
public void Should_Not_Be_Able_To_Convert_Larger_Than_Long_Values() { Assert.Throws<ArgumentOutOfRangeException>(() => ToWords.ToString(long.MaxValue)); }
public void Should_Convert_Big_Integer_Values() { string s = ToWords.ToString(int.MaxValue); Assert.IsNotNullOrEmpty(s); }
public void Should_Convert_Maximum_Integer_Values() { ToWords.ToString(Int32.MaxValue); }