Ejemplo n.º 1
0
        public void IsBaseOf_NullUri()
        {
            UnitTestUriParser p = new UnitTestUriParser();

            p._IsBaseOf(null, http);
        }
Ejemplo n.º 2
0
        public void IsBaseOf_UriNull()
        {
            UnitTestUriParser p = new UnitTestUriParser();

            p._IsBaseOf(http, null);
        }
Ejemplo n.º 3
0
        public void IsBaseOf()
        {
            UnitTestUriParser p = new UnitTestUriParser();

            Assert.IsTrue(p._IsBaseOf(http, http), "http-http");

            Uri u = new Uri("http://www.mono-project.com/Main_Page#FAQ");

            Assert.IsTrue(p._IsBaseOf(u, http), "http-1a");
            Assert.IsTrue(p._IsBaseOf(http, u), "http-1b");

            u = new Uri("http://www.mono-project.com/Main_Page");
            Assert.IsTrue(p._IsBaseOf(u, http), "http-2a");
            Assert.IsTrue(p._IsBaseOf(http, u), "http-2b");

            u = new Uri("http://www.mono-project.com/");
            Assert.IsTrue(p._IsBaseOf(u, http), "http-3a");
            Assert.IsTrue(p._IsBaseOf(http, u), "http-3b");

            u = new Uri("http://www.mono-project.com/Main_Page/");
            Assert.IsFalse(p._IsBaseOf(u, http), "http-4a");
            Assert.IsTrue(p._IsBaseOf(http, u), "http-4b");

            // docs says the UserInfo isn't evaluated, but...
            u = new Uri("http://*****:*****@www.mono-project.com/Main_Page");
            Assert.IsFalse(p._IsBaseOf(u, http), "http-5a");
            Assert.IsFalse(p._IsBaseOf(http, u), "http-5b");

            // scheme case sensitive ? no
            u = new Uri("HTTP://www.mono-project.com/Main_Page");
            Assert.IsTrue(p._IsBaseOf(u, http), "http-6a");
            Assert.IsTrue(p._IsBaseOf(http, u), "http-6b");

            // host case sensitive ? no
            u = new Uri("http://www.Mono-Project.com/Main_Page");
            Assert.IsTrue(p._IsBaseOf(u, http), "http-7a");
            Assert.IsTrue(p._IsBaseOf(http, u), "http-7b");

            // path case sensitive ? no
            u = new Uri("http://www.Mono-Project.com/MAIN_Page");
            Assert.IsTrue(p._IsBaseOf(u, http), "http-8a");
            Assert.IsTrue(p._IsBaseOf(http, u), "http-8b");

            // different scheme
            u = new Uri("ftp://www.mono-project.com/Main_Page");
            Assert.IsFalse(p._IsBaseOf(u, http), "http-9a");
            Assert.IsFalse(p._IsBaseOf(http, u), "http-9b");

            // different host
            u = new Uri("http://www.go-mono.com/Main_Page");
            Assert.IsFalse(p._IsBaseOf(u, http), "http-10a");
            Assert.IsFalse(p._IsBaseOf(http, u), "http-10b");

            // different port
            u = new Uri("http://www.mono-project.com:8080/");
            Assert.IsFalse(p._IsBaseOf(u, http), "http-11a");
            Assert.IsFalse(p._IsBaseOf(http, u), "http-11b");

            // specify default port
            u = new Uri("http://www.mono-project.com:80/");
            Assert.IsTrue(p._IsBaseOf(u, http), "http-12a");
            Assert.IsTrue(p._IsBaseOf(http, u), "http-12b");
        }
Ejemplo n.º 4
0
		public void IsBaseOf_NullUri ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			p._IsBaseOf (null, http);
		}
Ejemplo n.º 5
0
		public void IsBaseOf_UriNull ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			p._IsBaseOf (http, null);
		}
Ejemplo n.º 6
0
		public void IsBaseOf ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			Assert.IsTrue (p._IsBaseOf (http, http), "http-http");

			Uri u = new Uri ("http://www.mono-project.com/Main_Page#FAQ");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-1a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-1b");

			u = new Uri ("http://www.mono-project.com/Main_Page");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-2a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-2b");

			u = new Uri ("http://www.mono-project.com/");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-3a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-3b");

			u = new Uri ("http://www.mono-project.com/Main_Page/");
			Assert.IsFalse (p._IsBaseOf (u, http), "http-4a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-4b");

			// docs says the UserInfo isn't evaluated, but...
			u = new Uri ("http://*****:*****@www.mono-project.com/Main_Page");
			Assert.IsFalse (p._IsBaseOf (u, http), "http-5a");
			Assert.IsFalse (p._IsBaseOf (http, u), "http-5b");

			// scheme case sensitive ? no
			u = new Uri ("HTTP://www.mono-project.com/Main_Page");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-6a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-6b");

			// host case sensitive ? no
			u = new Uri ("http://www.Mono-Project.com/Main_Page");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-7a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-7b");

			// path case sensitive ? no
			u = new Uri ("http://www.Mono-Project.com/MAIN_Page");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-8a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-8b");

			// different scheme
			u = new Uri ("ftp://www.mono-project.com/Main_Page");
			Assert.IsFalse (p._IsBaseOf (u, http), "http-9a");
			Assert.IsFalse (p._IsBaseOf (http, u), "http-9b");

			// different host
			u = new Uri ("http://www.go-mono.com/Main_Page");
			Assert.IsFalse (p._IsBaseOf (u, http), "http-10a");
			Assert.IsFalse (p._IsBaseOf (http, u), "http-10b");

			// different port
			u = new Uri ("http://www.mono-project.com:8080/");
			Assert.IsFalse (p._IsBaseOf (u, http), "http-11a");
			Assert.IsFalse (p._IsBaseOf (http, u), "http-11b");

			// specify default port
			u = new Uri ("http://www.mono-project.com:80/");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-12a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-12b");
		}