public void ToString_isString() { var quat = new QuaternionD(1, 2, 3, 4); var actual = quat.ToString(); Assert.Equal("V: (1, 2, 3), w: 4", actual); }
/// <summary> /// Converts the given value object to the specified type, using the specified context and culture information. /// </summary> /// <param name="context">An <see cref="ITypeDescriptorContext"/> that provides a format context.</param> /// <param name="culture">A <see cref="System.Globalization.CultureInfo"/> object. If a null reference (Nothing in Visual Basic) is passed, the current culture is assumed.</param> /// <param name="value">The <see cref="Object"/> to convert.</param> /// <param name="destinationType">The Type to convert the <paramref name="value"/> parameter to.</param> /// <returns>An <see cref="Object"/> that represents the converted value.</returns> public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if ((destinationType == typeof(string)) && (value is QuaternionD)) { QuaternionD q = (QuaternionD)value; return(q.ToString()); } return(base.ConvertTo(context, culture, value, destinationType)); }