Ejemplo n.º 1
0
        public static void CanConvertFromInt32()
        {
            // Arrange
            var converter = new DecimalConverter();

            // Act
            var result = converter.CanConvertFrom(typeof(int));

            // Assert
            Assert.True(result);
        }
Ejemplo n.º 2
0
        public override bool CanConvertFrom(object sourceValue, Type destinationType)
        {
            if (sourceValue == null)
            {
                return(true);
            }
            if (sourceValue.GetType() == typeof(decimal))
            {
                return(true);
            }

            DecimalConverter dc = new DecimalConverter();

            return(dc.CanConvertFrom(sourceValue.GetType()));
        }