public void WhenCalledConvertBack_ReturnsCorrectValueType() { const double value = 123.4567; var doubleToDecimalConverter = new DoubleToDecimalConverter(); Assert.IsInstanceOfType(doubleToDecimalConverter.ConvertBack(value, null, null, null), typeof(decimal)); Assert.AreEqual((decimal)value, doubleToDecimalConverter.ConvertBack(value, null, null, null)); }
public void ConvertTest() { var converter = new DoubleToDecimalConverter(); const double Expected = 12.34; var actual = converter.Convert(Expected, null, null, CultureInfo.InvariantCulture); Assert.AreEqual(Expected, actual); }
public void ConvertBackTest() { var converter = new DoubleToDecimalConverter(); const double DoubleValue = 12.34; const decimal DecimalValue = (decimal)DoubleValue; var actual = converter.ConvertBack(DoubleValue, null, null, CultureInfo.InvariantCulture); Assert.IsTrue(actual is decimal); Assert.AreEqual(DecimalValue, actual); }
public void WhenCalledConvert_ReturnsValue() { const double value = 123.4567; var doubleToIntegerConverter = new DoubleToDecimalConverter(); Assert.AreEqual(value, doubleToIntegerConverter.Convert(value, null, null, null)); }