public void Execute_InvalidNumeric_Null(string text, string culture) { var cultureInfo = new CultureInfo(culture); var converter = new TextToNumericConverter(cultureInfo, null); var newValue = converter.Execute(text); Assert.That(newValue, Is.Null); }
public void Execute_InvalidNumeric_Decimal(string text, string culture) { var cultureInfo = new CultureInfo(culture); var converter = new TextToNumericConverter(cultureInfo, -1m); var newValue = converter.Execute(text); Assert.That(newValue, Is.TypeOf <Decimal>()); Assert.That(newValue, Is.EqualTo(-1)); }
public void Execute_ValidNumeric_Decimal(string culture) { var cultureInfo = new CultureInfo(culture); var text = (100.456).ToString(cultureInfo.NumberFormat); Console.WriteLine(text); var converter = new TextToNumericConverter(cultureInfo, -1m); var newValue = converter.Execute(text); Assert.That(newValue, Is.TypeOf <Decimal>()); Assert.That(newValue, Is.EqualTo(new Decimal(100.456))); }