コード例 #1
0
 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));
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public void WhenCalledConvert_ReturnsValue()
 {
     const double value = 123.4567;
     var doubleToIntegerConverter = new DoubleToDecimalConverter();
     Assert.AreEqual(value, doubleToIntegerConverter.Convert(value, null, null, null));
 }