public CanConvertTo ( ITypeDescriptorContext context, |
||
context | ITypeDescriptorContext | Additional context for conversion. |
destinationType | The type of the destination object. | |
return | bool |
public void ConvertToInteger() { var converter = new EncodingConverter(); Assert.IsTrue(converter.CanConvertTo(typeof(int)), "Cannot convert to an integer."); var value = (int)converter.ConvertTo(Encoding.UTF8, typeof(int)); Assert.AreEqual<int>(65001, value, "Could not convert to an integer."); }
public void ConvertToInteger() { var converter = new EncodingConverter(); Assert.IsTrue(converter.CanConvertTo(typeof(int)), "Cannot convert to an integer."); var value = (int)converter.ConvertTo(Encoding.UTF8, typeof(int)); Assert.AreEqual <int>(65001, value, "Could not convert to an integer."); }
public void ConvertToString() { var converter = new EncodingConverter(); Assert.IsTrue(converter.CanConvertTo(typeof(string)), "Cannot convert to a string"); var value = (string)converter.ConvertTo(Encoding.UTF8, typeof(string)); Assert.AreEqual("utf-8", value, true, "Could not convert to a string."); }
public void ConvertToString() { var converter = new EncodingConverter(); Assert.IsTrue(converter.CanConvertTo(typeof(string)), "Cannot convert to a string"); var value = (string)converter.ConvertTo(Encoding.UTF8, typeof(string)); Assert.AreEqual("utf-8", value, true, "Could not convert to a string."); }