public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { ValidateType(value, typeof(TimeSpan)); if ((TimeSpan)value == TimeSpan.MaxValue) { return "Infinite"; } else { return base.ConvertTo(ctx, ci, value, type); } }
public void ConvertTo_TypeError1 () { TimeSpanMinutesOrInfiniteConverter cv = new TimeSpanMinutesOrInfiniteConverter (); Assert.AreEqual ("59", cv.ConvertTo (null, null, 59, typeof (string)), "A1"); }