public void Whole_Tens_WithDecimal_ReturnsCorrectly() { var expected = "fifty DOLLARS AND fifty three CENTS"; var res = ChequeWriterUtil.GetString(50.53m); Assert.Equal(expected, res); }
public void Hundreds_ReturnsCorrectly() { var expected = "two hundred and fifty four DOLLARS"; var res = ChequeWriterUtil.GetString(254.00m); Assert.Equal(expected, res); }
public void One_WithDecimal_ReturnsCorrectly() { var expected = "one DOLLAR AND fifty CENTS"; var res = ChequeWriterUtil.GetString(1.5m); Assert.Equal(expected, res); }
public void Zero_ReturnsZero() { var expected = "zero"; var res = ChequeWriterUtil.GetString(0); Assert.Equal(expected, res); }
public void Whole_TenBillions_WithDecimalReturnsCorrectly() { var expected = "ninety two billion DOLLARS AND fifty three CENTS"; var res = ChequeWriterUtil.GetString(92000000000.53m); Assert.Equal(expected, res); }
public void TenBillions_WithDecimalReturnsCorrectly() { var expected = "ninety two billion, eight hundred and seventeen million, six hundred and twenty one thousand, two hundred and fifty four DOLLARS AND fifty three CENTS"; var res = ChequeWriterUtil.GetString(92817621254.53m); Assert.Equal(expected, res); }
public void HundredThousands_ReturnsCorrectly() { var expected = "six hundred and twenty one thousand, two hundred and fifty four DOLLARS"; var res = ChequeWriterUtil.GetString(621254.00m); Assert.Equal(expected, res); }
public void Above_TwoBillions_AreNotSupported() { var expected = "more than 2 billion are not supported"; var res = ChequeWriterUtil.GetString(2000000000.01m); Assert.Equal(expected, res); }
public void Whole_HundredThousands_ReturnsCorrectly() { var expected = "six hundred thousand DOLLARS"; var res = ChequeWriterUtil.GetString(600000); Assert.Equal(expected, res); }
public void Whole_HundredThousands_WithDecimal_ReturnsCorrectly() { var expected = "six hundred thousand DOLLARS AND fifty three CENTS"; var res = ChequeWriterUtil.GetString(600000.53m); Assert.Equal(expected, res); }
public void Whole_TenThousands_ReturnsCorrectly() { var expected = "twenty thousand DOLLARS"; var res = ChequeWriterUtil.GetString(20000.00m); Assert.Equal(expected, res); }
public void Thousands_WithDecimal_ReturnsCorrectly() { var expected = "one thousand, two hundred and fifty four DOLLARS AND fifty three CENTS"; var res = ChequeWriterUtil.GetString(1254.53m); Assert.Equal(expected, res); }
public void Thousands_ReturnsCorrectly() { var expected = "eleven thousand DOLLARS"; var res = ChequeWriterUtil.GetString(11000.00m); Assert.Equal(expected, res); }
public void WholeBillions_ReturnsCorrectly() { var expected = "one billion DOLLARS"; var res = ChequeWriterUtil.GetString(1000000000); Assert.Equal(expected, res); }
public void MoreThan_2Decimals_Are_RoundedUp() { var expected = "two CENTS"; var res = ChequeWriterUtil.GetString(0.0150m); Assert.Equal(expected, res); }
public void Billions_WithDecimal_ReturnsCorrectly() { var expected = "one billion, nine hundred and ninety nine million, nine hundred and ninety nine thousand, nine hundred and ninety nine DOLLARS AND ninety nine CENTS"; var res = ChequeWriterUtil.GetString(1999999999.99m); Assert.Equal(expected, res); }
public void Millions_WithDecimal_ReturnsCorrectly() { var expected = "three million, six hundred and twenty one thousand, two hundred and fifty four DOLLARS AND fifty three CENTS"; var res = ChequeWriterUtil.GetString(3621254.53m); Assert.Equal(expected, res); }
public void Whole_TenBillions_ReturnsCorrectly() { var expected = "ninety two billion DOLLARS"; var res = ChequeWriterUtil.GetString(92000000000); Assert.Equal(expected, res); }
public void Whole_TenMillions_ReturnsCorrectly() { var expected = "seventeen million DOLLARS"; var res = ChequeWriterUtil.GetString(17000000); Assert.Equal(expected, res); }
public void Decimals_ReturnsCorrectly() { var expected = "thirteen CENTS"; var res = ChequeWriterUtil.GetString(0.13m); Assert.Equal(expected, res); }
public void Whole_HundredMillions_ReturnsCorrectly() { var expected = "eight hundred million DOLLARS"; var res = ChequeWriterUtil.GetString(800000000); Assert.Equal(expected, res); }
public void One_ReturnsCorrectly() { var expected = "one DOLLAR"; var res = ChequeWriterUtil.GetString(1); Assert.Equal(expected, res); }
public void Whole_HundredMillions_WithDecimal_ReturnsCorrectly() { var expected = "eight hundred million DOLLARS AND fifty three CENTS"; var res = ChequeWriterUtil.GetString(800000000.53m); Assert.Equal(expected, res); }
public void Ones_ReturnsCorrectly() { var expected = "four DOLLARS"; var res = ChequeWriterUtil.GetString(4); Assert.Equal(expected, res); }
public void OneCent_ReturnsCorrectly() { var expected = "one CENT"; var res = ChequeWriterUtil.GetString(0.01m); Assert.Equal(expected, res); }
public void Whole_Tens_ReturnsCorrectly() { var expected = "fifty DOLLARS"; var res = ChequeWriterUtil.GetString(50m); Assert.Equal(expected, res); }
public void HundredMillions_ReturnsCorrectly() { var expected = "eight hundred and seventeen million, six hundred and twenty one thousand, two hundred and fifty four DOLLARS"; var res = ChequeWriterUtil.GetString(817621254); Assert.Equal(expected, res); }
public void Whole_Hundreds_ReturnsCorrectly() { var expected = "two hundred DOLLARS"; var res = ChequeWriterUtil.GetString(200.00m); Assert.Equal(expected, res); }
static void Main(string[] args) { Console.WriteLine("--- Cheque Writer Utility ---"); Console.WriteLine("- Enter a number up to 2 billion, with or without decimal parts"); Console.WriteLine("- Enter 'quit' to exit"); string input = Console.ReadLine(); while (string.IsNullOrEmpty(input) || !input.ToLower().Equals("quit")) { decimal number = 0; if (!decimal.TryParse(input, out number)) { Console.WriteLine("Please enter a valid number"); } else { Console.WriteLine(ChequeWriterUtil.GetString(number)); } input = Console.ReadLine(); } }