public void TestSingleDigit() { string test = "One"; Assert.IsTrue(TextToNumber.IsValid(test)); Assert.AreEqual(string.Empty, TextToNumber.Error); Assert.AreEqual(1, TextToNumber.DoConvert(test)); }
public void Test57Digit() { string test = "Fifty seven"; Assert.IsTrue(TextToNumber.IsValid(test), TextToNumber.Error); Assert.AreEqual(string.Empty, TextToNumber.Error); Assert.AreEqual(57, TextToNumber.DoConvert(test)); Assert.AreEqual(string.Empty, TextToNumber.Error); }
public void TestTenDigit() { string test = "forty"; Assert.IsTrue(TextToNumber.IsValid(test)); Assert.AreEqual(string.Empty, TextToNumber.Error); Assert.AreEqual(40, TextToNumber.DoConvert(test)); Assert.AreEqual(string.Empty, TextToNumber.Error); }
public void TestMultipleTeens() { string test = "Fourteen twelve"; Assert.IsFalse(TextToNumber.IsValid(test)); Assert.AreEqual("Did not expect the word type of teens or tens in the position of second digit for twelve\r\n", TextToNumber.Error); Assert.AreEqual(0, TextToNumber.DoConvert(test)); Assert.AreEqual("Did not expect the word type of teens or tens in the position of second digit for twelve\r\n", TextToNumber.Error); }
public void TestMultipleDigit() { string test = "One two"; Assert.IsFalse(TextToNumber.IsValid(test)); Assert.AreEqual("Second digit is not valid two\r\n", TextToNumber.Error); Assert.AreEqual(0, TextToNumber.DoConvert(test)); Assert.AreEqual("Second digit is not valid two\r\n", TextToNumber.Error); }
public void Test159000Digit() { string test = "one Hundred and fifty nine thousand"; Assert.IsTrue(TextToNumber.IsValid(test), TextToNumber.Error); Assert.AreEqual(string.Empty, TextToNumber.Error); Assert.AreEqual(159000, TextToNumber.DoConvert(test)); Assert.AreEqual(string.Empty, TextToNumber.Error); }
public void TestHundredWithTeens() { string test = "seventeen Hundred thousand million"; Assert.IsFalse(TextToNumber.IsValid(test)); Assert.AreEqual("The Hundred can only follow a digit word\r\n", TextToNumber.Error); Assert.AreEqual(0, TextToNumber.DoConvert(test)); Assert.AreEqual("The Hundred can only follow a digit word\r\n", TextToNumber.Error); }
public void Test10010001000000Digit() { string test = "one Hundred thousand million"; Assert.IsTrue(TextToNumber.IsValid(test)); Assert.AreEqual(string.Empty, TextToNumber.Error); Assert.AreEqual(100000000000, TextToNumber.DoConvert(test)); Assert.AreEqual(string.Empty, TextToNumber.Error); }
public void Test157DigitWithNoFirstDigit() { string test = "Hundred and Fifty seven"; Assert.IsFalse(TextToNumber.IsValid(test), TextToNumber.Error); Assert.AreEqual("Expecting a number word rather than : hundred\r\nExpecting a number word rather than : and\r\n", TextToNumber.Error); Assert.AreEqual(0, TextToNumber.DoConvert(test)); Assert.AreEqual("Expecting a number word rather than : hundred\r\nExpecting a number word rather than : and\r\n", TextToNumber.Error); }
public void Test7_50Digit() { string test = "seven Fifty"; Assert.IsFalse(TextToNumber.IsValid(test), TextToNumber.Error); Assert.AreEqual("Did not expect the word type of teens or tens in the position of second digit for fifty\r\n", TextToNumber.Error); Assert.AreEqual(0, TextToNumber.DoConvert(test)); Assert.AreEqual("Did not expect the word type of teens or tens in the position of second digit for fifty\r\n", TextToNumber.Error); }