public void ShouldReturnOriginalValueForNonNullableDecimalTarget()
        {
            StringToNullableNumberConverter converter = new StringToNullableNumberConverter();

            string source = 10.05.ToString(CultureInfo.CurrentCulture);

            object result = converter.ConvertBack(source, typeof(decimal), null, null);

            Assert.AreSame(source, result);
        }
        public void ShouldReturnNullForInvalidInteger()
        {
            StringToNullableNumberConverter converter = new StringToNullableNumberConverter();

            string source = "xxx";

            object result = converter.ConvertBack(source, typeof(int?), null, null);

            Assert.IsNull(result);
        }
        public void ShouldReturnOriginalValueForNonNullableIntFromString()
        {
            StringToNullableNumberConverter converter = new StringToNullableNumberConverter();

            string source = "123";

            object result = converter.ConvertBack(source, typeof(int), null, null);

            Assert.AreSame(source, result);
        }
        public void ShouldConvertValidDecimalFromString()
        {
            StringToNullableNumberConverter converter = new StringToNullableNumberConverter();

            string source = 10.05.ToString(CultureInfo.CurrentCulture);
            
            object result = converter.ConvertBack(source, typeof(decimal?), null, null);

            Assert.IsInstanceOfType(result, typeof(decimal));
            Assert.AreEqual<decimal>(10.05M, (decimal)result);
        }
        public void ShouldConvertValidIntFromString()
        {
            StringToNullableNumberConverter converter = new StringToNullableNumberConverter();

            string source = "123";

            object result = converter.ConvertBack(source, typeof(int?), null, null);

            Assert.IsInstanceOfType(result, typeof(int));
            Assert.AreEqual<int>(123, (int)result);
        }
 public void ShouldReturnSameValueInConvert()
 {
     StringToNullableNumberConverter converter = new StringToNullableNumberConverter();
     var convertedValue = converter.Convert(123, typeof(int), null, null);
     Assert.AreEqual(123, convertedValue);
 }