Example #1
0
        public void GetComponents_Ftp2()
        {
            UnitTestUriParser p = new UnitTestUriParser();

            Assert.AreEqual("ftp", p._GetComponents(ftp2, UriComponents.Scheme, UriFormat.Unescaped), "ftp.Scheme");
            Assert.AreEqual("username:password", p._GetComponents(ftp2, UriComponents.UserInfo, UriFormat.Unescaped), "ftp.UserInfo");
            Assert.AreEqual("ftp.go-mono.com", p._GetComponents(ftp2, UriComponents.Host, UriFormat.Unescaped), "ftp.Host");
            Assert.AreEqual(String.Empty, p._GetComponents(ftp2, UriComponents.Port, UriFormat.Unescaped), "ftp.Port");
            Assert.AreEqual("with some spaces/mono.tgz", p._GetComponents(ftp2, UriComponents.Path, UriFormat.Unescaped), "ftp.Path");
            Assert.AreEqual("with%20some%20spaces/mono.tgz", p._GetComponents(ftp2, UriComponents.Path, UriFormat.UriEscaped), "ftp.Path-UriEscaped");
            Assert.AreEqual("with some spaces/mono.tgz", p._GetComponents(ftp2, UriComponents.Path, UriFormat.SafeUnescaped), "ftp.Path-SafeUnescaped");
            Assert.AreEqual(String.Empty, p._GetComponents(ftp2, UriComponents.Query, UriFormat.Unescaped), "ftp.Query");
            Assert.AreEqual(String.Empty, p._GetComponents(ftp2, UriComponents.Fragment, UriFormat.Unescaped), "ftp.Fragment");
            Assert.AreEqual("21", p._GetComponents(ftp2, UriComponents.StrongPort, UriFormat.Unescaped), "ftp.StrongPort");
            Assert.AreEqual(String.Empty, p._GetComponents(ftp2, UriComponents.KeepDelimiter, UriFormat.Unescaped), "http.KeepDelimiter");
            Assert.AreEqual("ftp.go-mono.com:21", p._GetComponents(ftp2, UriComponents.HostAndPort, UriFormat.Unescaped), "http.HostAndPort");
            Assert.AreEqual("username:[email protected]:21", p._GetComponents(ftp2, UriComponents.StrongAuthority, UriFormat.Unescaped), "http.StrongAuthority");
            Assert.AreEqual("ftp://*****:*****@ftp.go-mono.com/with some spaces/mono.tgz", p._GetComponents(ftp2, UriComponents.AbsoluteUri, UriFormat.Unescaped), "http.AbsoluteUri");
            Assert.AreEqual("/with some spaces/mono.tgz", p._GetComponents(ftp2, UriComponents.PathAndQuery, UriFormat.Unescaped), "http.PathAndQuery");
            Assert.AreEqual("ftp://ftp.go-mono.com/with some spaces/mono.tgz", p._GetComponents(ftp2, UriComponents.HttpRequestUrl, UriFormat.Unescaped), "http.HttpRequestUrl");
            Assert.AreEqual("ftp://ftp.go-mono.com", p._GetComponents(ftp2, UriComponents.SchemeAndServer, UriFormat.Unescaped), "http.SchemeAndServer");
            Assert.AreEqual("ftp://*****:*****@ftp.go-mono.com/with some spaces/mono.tgz", p._GetComponents(ftp2, UriComponents.SerializationInfoString, UriFormat.Unescaped), "http.SerializationInfoString");
            Assert.AreSame(p, p._OnNewUri(), "OnNewUri");
            // strange mixup
            Assert.AreEqual("ftp://*****:*****@", p._GetComponents(ftp2, UriComponents.Scheme | UriComponents.UserInfo, UriFormat.Unescaped), "ftp.Scheme+UserInfo");
            Assert.AreEqual(":21/with some spaces/mono.tgz", p._GetComponents(ftp2, UriComponents.Path | UriComponents.StrongPort, UriFormat.Unescaped), "ftp.Path+StrongPort");
        }
Example #2
0
        public void GetComponents()
        {
            UnitTestUriParser p = new UnitTestUriParser();

            Assert.AreEqual("http", p._GetComponents(http, UriComponents.Scheme, UriFormat.SafeUnescaped), "http.Scheme");
            Assert.AreEqual(String.Empty, p._GetComponents(http, UriComponents.UserInfo, UriFormat.SafeUnescaped), "http.UserInfo");
            Assert.AreEqual("www.mono-project.com", p._GetComponents(http, UriComponents.Host, UriFormat.SafeUnescaped), "http.Host");
            Assert.AreEqual(String.Empty, p._GetComponents(http, UriComponents.Port, UriFormat.SafeUnescaped), "http.Port");
            Assert.AreEqual("Main_Page", p._GetComponents(http, UriComponents.Path, UriFormat.SafeUnescaped), "http.Path");
            Assert.AreEqual(String.Empty, p._GetComponents(http, UriComponents.Query, UriFormat.SafeUnescaped), "http.Query");
            Assert.AreEqual("FAQ?Edit", p._GetComponents(http, UriComponents.Fragment, UriFormat.SafeUnescaped), "http.Fragment");
            Assert.AreEqual("80", p._GetComponents(http, UriComponents.StrongPort, UriFormat.SafeUnescaped), "http.StrongPort");
            Assert.AreEqual(String.Empty, p._GetComponents(http, UriComponents.KeepDelimiter, UriFormat.SafeUnescaped), "http.KeepDelimiter");
            Assert.AreEqual("www.mono-project.com:80", p._GetComponents(http, UriComponents.HostAndPort, UriFormat.SafeUnescaped), "http.HostAndPort");
            Assert.AreEqual("www.mono-project.com:80", p._GetComponents(http, UriComponents.StrongAuthority, UriFormat.SafeUnescaped), "http.StrongAuthority");
            Assert.AreEqual(full_http, p._GetComponents(http, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped), "http.AbsoluteUri");
            Assert.AreEqual("/Main_Page", p._GetComponents(http, UriComponents.PathAndQuery, UriFormat.SafeUnescaped), "http.PathAndQuery");
            Assert.AreEqual("http://www.mono-project.com/Main_Page", p._GetComponents(http, UriComponents.HttpRequestUrl, UriFormat.SafeUnescaped), "http.HttpRequestUrl");
            Assert.AreEqual("http://www.mono-project.com", p._GetComponents(http, UriComponents.SchemeAndServer, UriFormat.SafeUnescaped), "http.SchemeAndServer");
            Assert.AreEqual(full_http, p._GetComponents(http, UriComponents.SerializationInfoString, UriFormat.SafeUnescaped), "http.SerializationInfoString");
            // strange mixup
            Assert.AreEqual("http://", p._GetComponents(http, UriComponents.Scheme | UriComponents.Port, UriFormat.SafeUnescaped), "http.Scheme+Port");
            Assert.AreEqual("www.mono-project.com#FAQ?Edit", p._GetComponents(http, UriComponents.Host | UriComponents.Fragment, UriFormat.SafeUnescaped), "http.Scheme+Port");
            Assert.AreEqual("/Main_Page", p._GetComponents(http, UriComponents.Port | UriComponents.Path, UriFormat.SafeUnescaped), "http.Scheme+Port");
            Assert.AreSame(p, p._OnNewUri(), "OnNewUri");
        }
Example #3
0
		public void GetComponents_Ftp2 ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			Assert.AreEqual ("ftp", p._GetComponents (ftp2, UriComponents.Scheme, UriFormat.Unescaped), "ftp.Scheme");
			Assert.AreEqual ("username:password", p._GetComponents (ftp2, UriComponents.UserInfo, UriFormat.Unescaped), "ftp.UserInfo");
			Assert.AreEqual ("ftp.go-mono.com", p._GetComponents (ftp2, UriComponents.Host, UriFormat.Unescaped), "ftp.Host");
			Assert.AreEqual (String.Empty, p._GetComponents (ftp2, UriComponents.Port, UriFormat.Unescaped), "ftp.Port");
			Assert.AreEqual ("with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.Path, UriFormat.Unescaped), "ftp.Path");
			Assert.AreEqual ("with%20some%20spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.Path, UriFormat.UriEscaped), "ftp.Path-UriEscaped");
			Assert.AreEqual ("with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.Path, UriFormat.SafeUnescaped), "ftp.Path-SafeUnescaped");
			Assert.AreEqual (String.Empty, p._GetComponents (ftp2, UriComponents.Query, UriFormat.Unescaped), "ftp.Query");
			Assert.AreEqual (String.Empty, p._GetComponents (ftp2, UriComponents.Fragment, UriFormat.Unescaped), "ftp.Fragment");
			Assert.AreEqual ("21", p._GetComponents (ftp2, UriComponents.StrongPort, UriFormat.Unescaped), "ftp.StrongPort");
			Assert.AreEqual (String.Empty, p._GetComponents (ftp2, UriComponents.KeepDelimiter, UriFormat.Unescaped), "http.KeepDelimiter");
			Assert.AreEqual ("ftp.go-mono.com:21", p._GetComponents (ftp2, UriComponents.HostAndPort, UriFormat.Unescaped), "http.HostAndPort");
			Assert.AreEqual ("username:[email protected]:21", p._GetComponents (ftp2, UriComponents.StrongAuthority, UriFormat.Unescaped), "http.StrongAuthority");
			Assert.AreEqual ("ftp://*****:*****@ftp.go-mono.com/with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.AbsoluteUri, UriFormat.Unescaped), "http.AbsoluteUri");
			Assert.AreEqual ("/with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.PathAndQuery, UriFormat.Unescaped), "http.PathAndQuery");
			Assert.AreEqual ("ftp://ftp.go-mono.com/with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.HttpRequestUrl, UriFormat.Unescaped), "http.HttpRequestUrl");
			Assert.AreEqual ("ftp://ftp.go-mono.com", p._GetComponents (ftp2, UriComponents.SchemeAndServer, UriFormat.Unescaped), "http.SchemeAndServer");
			Assert.AreEqual ("ftp://*****:*****@ftp.go-mono.com/with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.SerializationInfoString, UriFormat.Unescaped), "http.SerializationInfoString");
			Assert.AreSame (p, p._OnNewUri (), "OnNewUri");
			// strange mixup
			Assert.AreEqual ("ftp://*****:*****@", p._GetComponents (ftp2, UriComponents.Scheme | UriComponents.UserInfo, UriFormat.Unescaped), "ftp.Scheme+UserInfo");
			Assert.AreEqual (":21/with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.Path | UriComponents.StrongPort, UriFormat.Unescaped), "ftp.Path+StrongPort");
		}
Example #4
0
		public void GetComponents ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			Assert.AreEqual ("http", p._GetComponents (http, UriComponents.Scheme, UriFormat.SafeUnescaped), "http.Scheme");
			Assert.AreEqual (String.Empty, p._GetComponents (http, UriComponents.UserInfo, UriFormat.SafeUnescaped), "http.UserInfo");
			Assert.AreEqual ("www.mono-project.com", p._GetComponents (http, UriComponents.Host, UriFormat.SafeUnescaped), "http.Host");
			Assert.AreEqual (String.Empty, p._GetComponents (http, UriComponents.Port, UriFormat.SafeUnescaped), "http.Port");
			Assert.AreEqual ("Main_Page", p._GetComponents (http, UriComponents.Path, UriFormat.SafeUnescaped), "http.Path");
			Assert.AreEqual (String.Empty, p._GetComponents (http, UriComponents.Query, UriFormat.SafeUnescaped), "http.Query");
			Assert.AreEqual ("FAQ?Edit", p._GetComponents (http, UriComponents.Fragment, UriFormat.SafeUnescaped), "http.Fragment");
			Assert.AreEqual ("80", p._GetComponents (http, UriComponents.StrongPort, UriFormat.SafeUnescaped), "http.StrongPort");
			Assert.AreEqual (String.Empty, p._GetComponents (http, UriComponents.KeepDelimiter, UriFormat.SafeUnescaped), "http.KeepDelimiter");
			Assert.AreEqual ("www.mono-project.com:80", p._GetComponents (http, UriComponents.HostAndPort, UriFormat.SafeUnescaped), "http.HostAndPort");
			Assert.AreEqual ("www.mono-project.com:80", p._GetComponents (http, UriComponents.StrongAuthority, UriFormat.SafeUnescaped), "http.StrongAuthority");
			Assert.AreEqual (full_http, p._GetComponents (http, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped), "http.AbsoluteUri");
			Assert.AreEqual ("/Main_Page", p._GetComponents (http, UriComponents.PathAndQuery, UriFormat.SafeUnescaped), "http.PathAndQuery");
			Assert.AreEqual ("http://www.mono-project.com/Main_Page", p._GetComponents (http, UriComponents.HttpRequestUrl, UriFormat.SafeUnescaped), "http.HttpRequestUrl");
			Assert.AreEqual ("http://www.mono-project.com", p._GetComponents (http, UriComponents.SchemeAndServer, UriFormat.SafeUnescaped), "http.SchemeAndServer");
			Assert.AreEqual (full_http, p._GetComponents (http, UriComponents.SerializationInfoString, UriFormat.SafeUnescaped), "http.SerializationInfoString");
			// strange mixup
			Assert.AreEqual ("http://", p._GetComponents (http, UriComponents.Scheme | UriComponents.Port, UriFormat.SafeUnescaped), "http.Scheme+Port");
			Assert.AreEqual ("www.mono-project.com#FAQ?Edit", p._GetComponents (http, UriComponents.Host | UriComponents.Fragment, UriFormat.SafeUnescaped), "http.Scheme+Port");
			Assert.AreEqual ("/Main_Page", p._GetComponents (http, UriComponents.Port | UriComponents.Path, UriFormat.SafeUnescaped), "http.Scheme+Port");
			Assert.AreSame (p, p._OnNewUri (), "OnNewUri");
		}