Fix (existing and) remaining NotWorking tests for System.Uri
[mono.git] / mcs / class / System / Test / System / UriParserTest.cs
index 8dba8d1cb9bf2eabf4e2fb51bbc3a063f0ab68c3..f4a87f780254af0e9334b0dbb4e675f309453834 100644 (file)
@@ -234,7 +234,6 @@ namespace MonoTests.System {
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void InitializeAndValidate ()
                {
                        UriFormatException error = null;
@@ -245,7 +244,7 @@ namespace MonoTests.System {
 
                [Test]
                [ExpectedException (typeof (NullReferenceException))]
-               [Category ("NotWorking")]
+               // oh man, this is a bad boy.It should be ArgumentNullException.
                public void InitializeAndValidate_Null ()
                {
                        UriFormatException error = null;
@@ -380,6 +379,28 @@ namespace MonoTests.System {
                        Assert.IsTrue (UriParser.IsKnownScheme (scheme), "IsKnownScheme-true");
                }
 
+               [Test]
+               [Category ("NotWorking")]
+               public void OnRegister2 ()
+               {
+                       string scheme = prefix + "onregister2";
+                       Assert.IsFalse (UriParser.IsKnownScheme (scheme), "IsKnownScheme-false");
+                       UnitTestUriParser p = new UnitTestUriParser ();
+                       try {
+                               UriParser.Register (p, scheme, 2005);
+                               Uri uri = new Uri (scheme + "://foobar:2005");
+                               Assert.AreEqual (scheme, uri.Scheme, "uri-prefix");
+                               Assert.AreEqual (2005, uri.Port, "uri-port");
+                               
+                               Assert.AreEqual ("//foobar:2005", uri.LocalPath, "uri-localpath");
+                       }
+                       catch (NotSupportedException) {
+                               // special case / ordering
+                       }
+                       // if true then the registration is done before calling OnRegister
+                       Assert.IsTrue (UriParser.IsKnownScheme (scheme), "IsKnownScheme-true");
+               }
+
                [Test]
                [Category ("NotWorking")]
                public void Resolve ()
@@ -423,7 +444,7 @@ namespace MonoTests.System {
                        Assert.IsTrue (UriParser.IsKnownScheme ("net.tcp"), "net.tcp");
                        Assert.IsTrue (UriParser.IsKnownScheme ("news"), "news");
                        Assert.IsTrue (UriParser.IsKnownScheme ("nntp"), "nntp");
-                       // infered from class library
+                       // inferred from class library
                        Assert.IsTrue (UriParser.IsKnownScheme ("ldap"), "ldap");
                        Assert.IsFalse (UriParser.IsKnownScheme ("ldaps"), "ldaps");
                        // well known for not existing
@@ -432,6 +453,9 @@ namespace MonoTests.System {
                        // variations - mixed and upper case
                        Assert.IsTrue (UriParser.IsKnownScheme ("FiLe"), "FiLe");
                        Assert.IsTrue (UriParser.IsKnownScheme ("FTP"), "ftp");
+
+                       // see 496783
+                       Assert.IsFalse (UriParser.IsKnownScheme ("tcp"), "tcp");
                }
 
                [Test]