/* * ConvertTo */ /// <summary> /// Converts the given value object to the specified type, using the specified context and culture information. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context.</param> /// <param name="culture">A <see cref="T:System.Globalization.CultureInfo"></see>. If null is passed, the current culture is assumed.</param> /// <param name="value">The <see cref="T:System.Object"></see> to convert.</param> /// <param name="destinationType">The <see cref="T:System.Type"></see> to convert the value parameter to.</param> /// <returns> /// An <see cref="T:System.Object"></see> that represents the converted value. /// </returns> /// <exception cref="T:System.NotSupportedException">The conversion cannot be performed. </exception> /// <exception cref="T:System.ArgumentNullException">The destinationType parameter is null. </exception> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } NuGenToolTipInfo tooltipInfo = value as NuGenToolTipInfo; if (destinationType == typeof(InstanceDescriptor) && tooltipInfo != null) { object[] constructorValues; MemberInfo constructorInfo = NuGenToolTipInfoConverter.GetConstructorInfo( tooltipInfo, out constructorValues ); return(new InstanceDescriptor(constructorInfo, constructorValues)); } return(base.ConvertTo(context, culture, value, destinationType)); }
public void SetUp() { _converter = new NuGenToolTipInfoConverter(); _sampleImg = new Bitmap(1, 1); _sampleStr = "SampleStr"; }