public void Should_Return_FiftyFive_When_55() { // Arrange int input = 55; SpellNumberToWord spellObject = new SpellNumberToWord(); // Act string output = spellObject.SpellTheNumber(input); // Assert Assert.AreEqual("fifty five", output); }
public void Should_Return_WarningMessage_When_NegitiveInteger_IsPassed() { // Arrange int input = -100; SpellNumberToWord spellObject = new SpellNumberToWord(); // Act string output = spellObject.SpellTheNumber(input); // Assert Assert.AreEqual("Please enter positive Number", output); }
static void Main(string[] args) { SpellNumberToWord spellObj = new SpellNumberToWord(); Console.WriteLine("Enter an Whole Number:"); int enteredNumber; try { while (true) { enteredNumber = int.Parse(Console.ReadLine()); string numberSpelledToWord = spellObj.SpellTheNumber(enteredNumber); Console.WriteLine(numberSpelledToWord); } } catch { Console.WriteLine("Warning : Please enter correct number format"); } Console.ReadLine(); }