public void ConvertFrom() { UriConverter vrt = new UriConverter (); object actual = vrt.ConvertFrom ("svn://localhost/Spring/trunk/"); Assert.IsNotNull (actual); Assert.AreEqual (typeof (System.Uri), actual.GetType ()); }
/// <summary> /// Registers standard and configured type converters. /// </summary> static TypeConverterRegistry() { lock (_syncRoot) { _converters[typeof(string[])] = new StringArrayConverter(); _converters[typeof(Type)] = new RuntimeTypeConverter(); _converters[typeof(Uri)] = new UriConverter(); _converters[typeof(FileInfo)] = new FileInfoConverter(); _converters[typeof(NameValueCollection)] = new NameValueConverter(); _converters[typeof(Regex)] = new RegexConverter(); _converters[typeof(TimeSpan)] = new TimeSpanConverter(); } }
/// <summary> /// Registers standard and configured type converters. /// </summary> static TypeConverterRegistry() { lock (_syncRoot) { _converters[typeof(string[])] = new StringArrayConverter(); _converters[typeof(Type)] = new RuntimeTypeConverter(); _converters[typeof(Uri)] = new UriConverter(); _converters[typeof(FileInfo)] = new FileInfoConverter(); _converters[typeof(NameValueCollection)] = new NameValueConverter(); _converters[typeof(Regex)] = new RegexConverter(); _converters[typeof(TimeSpan)] = new TimeSpanConverter(); } }
public void ConvertFromMalformedUriBails() { try { UriConverter vrt = new UriConverter (); object actual = vrt.ConvertFrom ("$TheAngelGang"); } catch (Exception ex) { // check that the inner exception was doe to the malformed URL Assert.IsTrue (ex.InnerException is UriFormatException); } }
public void ConvertFromNullReference() { UriConverter vrt = new UriConverter (); object actual = vrt.ConvertFrom (null); }
public void ConvertFromNonSupportedOptionBails() { UriConverter vrt = new UriConverter (); object actual = vrt.ConvertFrom (12); }
public void CanConvertFrom() { UriConverter vrt = new UriConverter (); Assert.IsTrue (vrt.CanConvertFrom (typeof (string)), "Conversion from a string instance must be supported."); Assert.IsFalse (vrt.CanConvertFrom (typeof (int))); }