Exemplo n.º 1
0
 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 ());
 }
Exemplo n.º 2
0
        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)));
        }
Exemplo n.º 3
0
        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());
        }
Exemplo n.º 4
0
 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);
     }
 }
Exemplo n.º 5
0
 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);
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Registers standard and configured type converters.
        /// </summary>
        static TypeConverterRegistry()
        {
            lock (syncRoot)
            {
                converters[typeof(string[])]            = new StringArrayConverter();
                converters[typeof(Type)]                = new RuntimeTypeConverter();
                converters[typeof(Color)]               = new RGBColorConverter();
                converters[typeof(Uri)]                 = new UriConverter();
                converters[typeof(FileInfo)]            = new FileInfoConverter();
                converters[typeof(NameValueCollection)] = new NameValueConverter();
                converters[typeof(ResourceManager)]     = new ResourceManagerConverter();
                converters[typeof(Regex)]               = new RegexConverter();
                converters[typeof(TimeSpan)]            = new TimeSpanConverter();
                converters[typeof(ICredentials)]        = new CredentialConverter();
                converters[typeof(NetworkCredential)]   = new CredentialConverter();

                // register user-defined type converters
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Registers standard and configured type converters.
        /// </summary>
        static TypeConverterRegistry()
        {
            lock (converters.SyncRoot)
            {
                converters[typeof(string[])] = new StringArrayConverter();
                converters[typeof(Type)] = new RuntimeTypeConverter();
                converters[typeof(Color)] = new RGBColorConverter();
                converters[typeof(Uri)] = new UriConverter();
                converters[typeof(FileInfo)] = new FileInfoConverter();
                converters[typeof(Stream)] = new StreamConverter();
                converters[typeof(NameValueCollection)] = new NameValueConverter();
                converters[typeof(ResourceManager)] = new ResourceManagerConverter();
                converters[typeof(Regex)] = new RegexConverter();
                converters[typeof(TimeSpan)] = new TimeSpanConverter();
                converters[typeof(ICredentials)] = new CredentialConverter();
                converters[typeof(NetworkCredential)] = new CredentialConverter();
                converters[typeof(RegistryKey)] = new RegistryKeyConverter();

                // register user-defined type converters
                ConfigurationUtils.GetSection(TypeConvertersSectionName);
            }
        }
Exemplo n.º 8
0
 public void ConvertFromNonSupportedOptionBails () 
 {
     UriConverter vrt = new UriConverter ();
     object actual = vrt.ConvertFrom (12);
 } 
Exemplo n.º 9
0
 public void ConvertFromNullReference () 
 {
     UriConverter vrt = new UriConverter ();
     object actual = vrt.ConvertFrom (null);
 }
Exemplo n.º 10
0
 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)));
 }
Exemplo n.º 11
0
        public void ConvertFromNonSupportedOptionBails()
        {
            UriConverter vrt = new UriConverter();

            Assert.Throws <NotSupportedException>(() => vrt.ConvertFrom(12));
        }
Exemplo n.º 12
0
        public void ConvertFromNullReference()
        {
            UriConverter vrt = new UriConverter();

            Assert.Throws <NotSupportedException>(() => vrt.ConvertFrom(null));
        }
Exemplo n.º 13
0
 public void ConvertFromNonSupportedOptionBails()
 {
     UriConverter vrt    = new UriConverter();
     object       actual = vrt.ConvertFrom(12);
 }
Exemplo n.º 14
0
 public void ConvertFromNullReference()
 {
     UriConverter vrt    = new UriConverter();
     object       actual = vrt.ConvertFrom(null);
 }
Exemplo n.º 15
0
 public void ConvertFromNonSupportedOptionBails () 
 {
     UriConverter vrt = new UriConverter ();
     Assert.Throws<NotSupportedException>(() => vrt.ConvertFrom (12));
 } 
Exemplo n.º 16
0
 public void ConvertFromNullReference () 
 {
     UriConverter vrt = new UriConverter ();
     Assert.Throws<NotSupportedException>(() => vrt.ConvertFrom (null));
 }