public void ConvertsBackStringToDecimalValue() { StringToCurrencyConverter converter = new StringToCurrencyConverter(); decimal result = (decimal)converter.ConvertBack(stringTestValue, null, null, CultureInfo.CurrentCulture); Assert.AreEqual(decimalTestValue, result, "Invalid back conversion from string to decimal."); }
public void ConvertsBackAndIgnoresTrailingDecimalSeparator() { StringToCurrencyConverter converter = new StringToCurrencyConverter(); string testString = "123" + sep; decimal result = (decimal)converter.ConvertBack(testString, null, null, CultureInfo.CurrentCulture); Assert.AreEqual(123.0m, result); }
public void ConvertsBackAndTrimsRedundantDecimalPlaces() { StringToCurrencyConverter converter = new StringToCurrencyConverter(); string testString = "123" + sep + "4567"; decimal result = (decimal)converter.ConvertBack(testString, null, null, CultureInfo.CurrentCulture); Assert.AreEqual(123.45m, result); }
public void ConvertsBackWithTrailingDecimalSeparatorAndAddsZero() { StringToCurrencyConverter converter = new StringToCurrencyConverter(); string testString = "123" + sep; decimal result = (decimal)converter.ConvertBack(testString, null, null, CultureInfo.CurrentCulture); string strResult = result.ToString(); Assert.AreEqual("123" + sep + "0", strResult); }