public virtual void TestGetSet()
        {
            string str = "ssh://DOMAIN\\user:[email protected]:33/some/p ath%20";
            URIish u   = new URIish(str);

            u = u.SetHost(u.GetHost());
            u = u.SetPass(u.GetPass());
            u = u.SetPort(u.GetPort());
            NUnit.Framework.Assert.AreEqual("ssh", u.GetScheme());
            NUnit.Framework.Assert.IsTrue(u.IsRemote());
            u = u.SetRawPath(u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("/some/p ath%20", u.GetRawPath());
            u = u.SetPath(u.GetPath());
            NUnit.Framework.Assert.AreEqual("/some/p ath ", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("/some/p ath ", u.GetPath());
            NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
            NUnit.Framework.Assert.AreEqual("DOMAIN\\user", u.GetUser());
            NUnit.Framework.Assert.AreEqual("pass", u.GetPass());
            NUnit.Framework.Assert.AreEqual(33, u.GetPort());
            NUnit.Framework.Assert.AreEqual("ssh://DOMAIN\\user:[email protected]:33/some/p ath "
                                            , u.ToPrivateString());
            NUnit.Framework.Assert.AreEqual("ssh://DOMAIN\\user:[email protected]:33/some/p%20ath%20"
                                            , u.ToPrivateASCIIString());
            NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
            NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateASCIIString(), u.ToASCIIString
                                                ());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestUserPasswordAndPort()
        {
            string str = "http://*****:*****@host.xy:80/some/path";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.AreEqual("http", u.GetScheme());
            NUnit.Framework.Assert.IsTrue(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("/some/path", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("/some/path", u.GetPath());
            NUnit.Framework.Assert.AreEqual("host.xy", u.GetHost());
            NUnit.Framework.Assert.AreEqual(80, u.GetPort());
            NUnit.Framework.Assert.AreEqual("user", u.GetUser());
            NUnit.Framework.Assert.AreEqual("secret", u.GetPass());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
            str = "http://*****:*****@[email protected]:80/some/path";
            u   = new URIish(str);
            NUnit.Framework.Assert.AreEqual("http", u.GetScheme());
            NUnit.Framework.Assert.IsTrue(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("/some/path", u.GetPath());
            NUnit.Framework.Assert.AreEqual("host.xy", u.GetHost());
            NUnit.Framework.Assert.AreEqual(80, u.GetPort());
            NUnit.Framework.Assert.AreEqual("user", u.GetUser());
            NUnit.Framework.Assert.AreEqual("secret@pass", u.GetPass());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestUNC()
        {
            string str = "\\\\some\\place";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.IsNull(u.GetScheme());
            NUnit.Framework.Assert.IsFalse(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("\\\\some\\place", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("\\\\some\\place", u.GetPath());
            NUnit.Framework.Assert.AreEqual("\\\\some\\place", u.ToString());
            NUnit.Framework.Assert.AreEqual("\\\\some\\place", u.ToASCIIString());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestURIEncode_unicode()
        {
            string str = "file:///home/m%c3%a5y";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
            NUnit.Framework.Assert.IsFalse(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("/home/m%c3%a5y", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("/home/m\u00e5y", u.GetPath());
            NUnit.Framework.Assert.AreEqual("file:///home/m%c3%a5y", u.ToString());
            NUnit.Framework.Assert.AreEqual("file:///home/m%c3%a5y", u.ToASCIIString());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestFileProtoWindows()
        {
            string str = "file:///D:/m y";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
            NUnit.Framework.Assert.IsFalse(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("D:/m y", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("D:/m y", u.GetPath());
            NUnit.Framework.Assert.AreEqual("file:///D:/m y", u.ToString());
            NUnit.Framework.Assert.AreEqual("file:///D:/m%20y", u.ToASCIIString());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestUnixFile()
        {
            string str = "/home/m y";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.IsNull(u.GetScheme());
            NUnit.Framework.Assert.IsFalse(u.IsRemote());
            NUnit.Framework.Assert.AreEqual(str, u.GetRawPath());
            NUnit.Framework.Assert.AreEqual(str, u.GetPath());
            NUnit.Framework.Assert.AreEqual(str, u.ToString());
            NUnit.Framework.Assert.AreEqual(str, u.ToASCIIString());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestRelativePath()
        {
            string str = "../../foo/bar";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.IsNull(u.GetScheme());
            NUnit.Framework.Assert.IsFalse(u.IsRemote());
            NUnit.Framework.Assert.AreEqual(str, u.GetRawPath());
            NUnit.Framework.Assert.AreEqual(str, u.GetPath());
            NUnit.Framework.Assert.AreEqual(str, u.ToString());
            NUnit.Framework.Assert.AreEqual(str, u.ToASCIIString());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestWindowsFile2()
        {
            string str = "D:\\m y";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.IsNull(u.GetScheme());
            NUnit.Framework.Assert.IsFalse(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("D:\\m y", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("D:\\m y", u.GetPath());
            NUnit.Framework.Assert.AreEqual("D:\\m y", u.ToString());
            NUnit.Framework.Assert.AreEqual("D:\\m y", u.ToASCIIString());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestGitProtoWindows()
        {
            string str = "git://example.com/D:/m y";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.AreEqual("git", u.GetScheme());
            NUnit.Framework.Assert.IsTrue(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("D:/m y", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("D:/m y", u.GetPath());
            NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
            NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
            NUnit.Framework.Assert.AreEqual("git://example.com/D:/m y", u.ToString());
            NUnit.Framework.Assert.AreEqual("git://example.com/D:/m%20y", u.ToASCIIString());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestScpStyleWithoutUserAbsolutePath()
        {
            string str = "example.com:/some/p ath";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.IsNull(u.GetScheme());
            NUnit.Framework.Assert.IsTrue(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetPath());
            NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
            NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
            NUnit.Framework.Assert.AreEqual(str, u.ToString());
            NUnit.Framework.Assert.AreEqual(str, u.ToASCIIString());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestSshProto()
        {
            string str = "ssh://example.com/some/p ath";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.AreEqual("ssh", u.GetScheme());
            NUnit.Framework.Assert.IsTrue(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetPath());
            NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
            NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
            NUnit.Framework.Assert.AreEqual("ssh://example.com/some/p ath", u.ToString());
            NUnit.Framework.Assert.AreEqual("ssh://example.com/some/p%20ath", u.ToASCIIString
                                                ());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestSshProtoWithUserAndPort()
        {
            string str = "ssh://[email protected]:33/some/p ath";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.AreEqual("ssh", u.GetScheme());
            NUnit.Framework.Assert.IsTrue(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetPath());
            NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
            NUnit.Framework.Assert.AreEqual("user", u.GetUser());
            NUnit.Framework.Assert.IsNull(u.GetPass());
            NUnit.Framework.Assert.AreEqual(33, u.GetPort());
            NUnit.Framework.Assert.AreEqual("ssh://[email protected]:33/some/p ath", u.ToString
                                                ());
            NUnit.Framework.Assert.AreEqual("ssh://[email protected]:33/some/p%20ath", u.ToASCIIString
                                                ());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestFileWithNoneUserHomeWithTilde()
        {
            string str = "/~some/p ath";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.IsNull(u.GetScheme());
            NUnit.Framework.Assert.IsFalse(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("/~some/p ath", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("/~some/p ath", u.GetPath());
            NUnit.Framework.Assert.IsNull(u.GetHost());
            NUnit.Framework.Assert.IsNull(u.GetUser());
            NUnit.Framework.Assert.IsNull(u.GetPass());
            NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
            NUnit.Framework.Assert.AreEqual(str, u.ToPrivateString());
            NUnit.Framework.Assert.AreEqual(str, u.ToPrivateASCIIString());
            NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
            NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateASCIIString(), u.ToASCIIString
                                                ());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestSshProtoWithEscapedADUserPassAndPort()
        {
            string str = "ssh://DOMAIN%5c\u00fcser:[email protected]:33/some/p ath";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.AreEqual("ssh", u.GetScheme());
            NUnit.Framework.Assert.IsTrue(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetPath());
            NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
            NUnit.Framework.Assert.AreEqual("DOMAIN\\\u00fcser", u.GetUser());
            NUnit.Framework.Assert.AreEqual("pass", u.GetPass());
            NUnit.Framework.Assert.AreEqual(33, u.GetPort());
            NUnit.Framework.Assert.AreEqual("ssh://DOMAIN\\\u00fcser:[email protected]:33/some/p ath"
                                            , u.ToPrivateString());
            NUnit.Framework.Assert.AreEqual("ssh://DOMAIN\\%c3%bcser:[email protected]:33/some/p%20ath"
                                            , u.ToPrivateASCIIString());
            NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
            NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateASCIIString(), u.ToASCIIString
                                                ());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestURIEncodeDecode()
        {
            string str = "ssh://%3ax%25:%40%[email protected]:33/some%c3%a5/p%20a th";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.AreEqual("ssh", u.GetScheme());
            NUnit.Framework.Assert.IsTrue(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("/some%c3%a5/p%20a th", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("/some\u00e5/p a th", u.GetPath());
            NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
            NUnit.Framework.Assert.AreEqual(":x%", u.GetUser());
            NUnit.Framework.Assert.AreEqual("@Ax", u.GetPass());
            NUnit.Framework.Assert.AreEqual(33, u.GetPort());
            NUnit.Framework.Assert.AreEqual("ssh://%3ax%25:%[email protected]:33/some%c3%a5/p%20a th"
                                            , u.ToPrivateString());
            NUnit.Framework.Assert.AreEqual("ssh://%3ax%25:%[email protected]:33/some%c3%a5/p%20a%20th"
                                            , u.ToPrivateASCIIString());
            NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
            NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateASCIIString(), u.ToASCIIString
                                                ());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestGitWithUserHome()
        {
            string str = "git://example.com/~some/p ath";
            URIish u   = new URIish(str);

            NUnit.Framework.Assert.AreEqual("git", u.GetScheme());
            NUnit.Framework.Assert.IsTrue(u.IsRemote());
            NUnit.Framework.Assert.AreEqual("~some/p ath", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("~some/p ath", u.GetPath());
            NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
            NUnit.Framework.Assert.IsNull(u.GetUser());
            NUnit.Framework.Assert.IsNull(u.GetPass());
            NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
            NUnit.Framework.Assert.AreEqual("git://example.com/~some/p ath", u.ToPrivateString
                                                ());
            NUnit.Framework.Assert.AreEqual("git://example.com/~some/p%20ath", u.ToPrivateASCIIString
                                                ());
            NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
            NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateASCIIString(), u.ToASCIIString
                                                ());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
        public virtual void TestFileProtocol()
        {
            // as defined by git docu
            URIish u = new URIish("file:///a/b.txt");

            NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
            NUnit.Framework.Assert.IsFalse(u.IsRemote());
            NUnit.Framework.Assert.IsNull(u.GetHost());
            NUnit.Framework.Assert.IsNull(u.GetPass());
            NUnit.Framework.Assert.AreEqual("/a/b.txt", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("/a/b.txt", u.GetPath());
            NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
            NUnit.Framework.Assert.IsNull(u.GetUser());
            NUnit.Framework.Assert.AreEqual("b.txt", u.GetHumanishName());
            FilePath tmp = FilePath.CreateTempFile("jgitUnitTest", ".tmp");

            u = new URIish(tmp.ToURI().ToString());
            NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
            NUnit.Framework.Assert.IsFalse(u.IsRemote());
            NUnit.Framework.Assert.IsNull(u.GetHost());
            NUnit.Framework.Assert.IsNull(u.GetPass());
            NUnit.Framework.Assert.IsTrue(u.GetPath().Contains("jgitUnitTest"));
            NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
            NUnit.Framework.Assert.IsNull(u.GetUser());
            NUnit.Framework.Assert.IsTrue(u.GetHumanishName().StartsWith("jgitUnitTest"));
            u = new URIish("file:/a/b.txt");
            NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
            NUnit.Framework.Assert.IsFalse(u.IsRemote());
            NUnit.Framework.Assert.IsNull(u.GetHost());
            NUnit.Framework.Assert.IsNull(u.GetPass());
            NUnit.Framework.Assert.AreEqual("/a/b.txt", u.GetRawPath());
            NUnit.Framework.Assert.AreEqual("/a/b.txt", u.GetPath());
            NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
            NUnit.Framework.Assert.IsNull(u.GetUser());
            NUnit.Framework.Assert.AreEqual("b.txt", u.GetHumanishName());
        }
Beispiel #18
0
		public virtual void TestFileProtoWindows()
		{
			string str = "file:///D:/m y";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
			NUnit.Framework.Assert.IsFalse(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("D:/m y", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("D:/m y", u.GetPath());
			NUnit.Framework.Assert.AreEqual("file:///D:/m y", u.ToString());
			NUnit.Framework.Assert.AreEqual("file:///D:/m%20y", u.ToASCIIString());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #19
0
		public virtual void TestURIEncode_unicode()
		{
			string str = "file:///home/m%c3%a5y";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
			NUnit.Framework.Assert.IsFalse(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("/home/m%c3%a5y", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("/home/m\u00e5y", u.GetPath());
			NUnit.Framework.Assert.AreEqual("file:///home/m%c3%a5y", u.ToString());
			NUnit.Framework.Assert.AreEqual("file:///home/m%c3%a5y", u.ToASCIIString());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #20
0
		public virtual void TestScpStyleWithUser()
		{
			string str = "[email protected]:some/p ath";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.IsNull(u.GetScheme());
			NUnit.Framework.Assert.IsTrue(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("some/p ath", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("some/p ath", u.GetPath());
			NUnit.Framework.Assert.AreEqual("user", u.GetUser());
			NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
			NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
			NUnit.Framework.Assert.AreEqual(str, u.ToString());
			NUnit.Framework.Assert.AreEqual(str, u.ToASCIIString());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #21
0
		public virtual void TestGitProtoWindows()
		{
			string str = "git://example.com/D:/m y";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.AreEqual("git", u.GetScheme());
			NUnit.Framework.Assert.IsTrue(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("D:/m y", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("D:/m y", u.GetPath());
			NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
			NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
			NUnit.Framework.Assert.AreEqual("git://example.com/D:/m y", u.ToString());
			NUnit.Framework.Assert.AreEqual("git://example.com/D:/m%20y", u.ToASCIIString());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #22
0
		public virtual void TestSshProtoWithUserAndPort()
		{
			string str = "ssh://[email protected]:33/some/p ath";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.AreEqual("ssh", u.GetScheme());
			NUnit.Framework.Assert.IsTrue(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetPath());
			NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
			NUnit.Framework.Assert.AreEqual("user", u.GetUser());
			NUnit.Framework.Assert.IsNull(u.GetPass());
			NUnit.Framework.Assert.AreEqual(33, u.GetPort());
			NUnit.Framework.Assert.AreEqual("ssh://[email protected]:33/some/p ath", u.ToString
				());
			NUnit.Framework.Assert.AreEqual("ssh://[email protected]:33/some/p%20ath", u.ToASCIIString
				());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #23
0
		public virtual void TestSshProto()
		{
			string str = "ssh://example.com/some/p ath";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.AreEqual("ssh", u.GetScheme());
			NUnit.Framework.Assert.IsTrue(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetPath());
			NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
			NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
			NUnit.Framework.Assert.AreEqual("ssh://example.com/some/p ath", u.ToString());
			NUnit.Framework.Assert.AreEqual("ssh://example.com/some/p%20ath", u.ToASCIIString
				());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #24
0
		public virtual void TestURIEncodeDecode()
		{
			string str = "ssh://%3ax%25:%40%[email protected]:33/some%c3%a5/p%20a th";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.AreEqual("ssh", u.GetScheme());
			NUnit.Framework.Assert.IsTrue(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("/some%c3%a5/p%20a th", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("/some\u00e5/p a th", u.GetPath());
			NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
			NUnit.Framework.Assert.AreEqual(":x%", u.GetUser());
			NUnit.Framework.Assert.AreEqual("@Ax", u.GetPass());
			NUnit.Framework.Assert.AreEqual(33, u.GetPort());
			NUnit.Framework.Assert.AreEqual("ssh://%3ax%25:%[email protected]:33/some%c3%a5/p%20a th"
				, u.ToPrivateString());
			NUnit.Framework.Assert.AreEqual("ssh://%3ax%25:%[email protected]:33/some%c3%a5/p%20a%20th"
				, u.ToPrivateASCIIString());
			NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
			NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateASCIIString(), u.ToASCIIString
				());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #25
0
		public virtual void TestFileProtocol()
		{
			// as defined by git docu
			URIish u = new URIish("file:///a/b.txt");
			NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
			NUnit.Framework.Assert.IsFalse(u.IsRemote());
			NUnit.Framework.Assert.IsNull(u.GetHost());
			NUnit.Framework.Assert.IsNull(u.GetPass());
			NUnit.Framework.Assert.AreEqual("/a/b.txt", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("/a/b.txt", u.GetPath());
			NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
			NUnit.Framework.Assert.IsNull(u.GetUser());
			NUnit.Framework.Assert.AreEqual("b.txt", u.GetHumanishName());
			FilePath tmp = FilePath.CreateTempFile("jgitUnitTest", ".tmp");
			u = new URIish(tmp.ToURI().ToString());
			NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
			NUnit.Framework.Assert.IsFalse(u.IsRemote());
			NUnit.Framework.Assert.IsNull(u.GetHost());
			NUnit.Framework.Assert.IsNull(u.GetPass());
			NUnit.Framework.Assert.IsTrue(u.GetPath().Contains("jgitUnitTest"));
			NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
			NUnit.Framework.Assert.IsNull(u.GetUser());
			NUnit.Framework.Assert.IsTrue(u.GetHumanishName().StartsWith("jgitUnitTest"));
			u = new URIish("file:/a/b.txt");
			NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
			NUnit.Framework.Assert.IsFalse(u.IsRemote());
			NUnit.Framework.Assert.IsNull(u.GetHost());
			NUnit.Framework.Assert.IsNull(u.GetPass());
			NUnit.Framework.Assert.AreEqual("/a/b.txt", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("/a/b.txt", u.GetPath());
			NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
			NUnit.Framework.Assert.IsNull(u.GetUser());
			NUnit.Framework.Assert.AreEqual("b.txt", u.GetHumanishName());
		}
Beispiel #26
0
		public virtual void TestFileWithNoneUserHomeWithTilde()
		{
			string str = "/~some/p ath";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.IsNull(u.GetScheme());
			NUnit.Framework.Assert.IsFalse(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("/~some/p ath", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("/~some/p ath", u.GetPath());
			NUnit.Framework.Assert.IsNull(u.GetHost());
			NUnit.Framework.Assert.IsNull(u.GetUser());
			NUnit.Framework.Assert.IsNull(u.GetPass());
			NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
			NUnit.Framework.Assert.AreEqual(str, u.ToPrivateString());
			NUnit.Framework.Assert.AreEqual(str, u.ToPrivateASCIIString());
			NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
			NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateASCIIString(), u.ToASCIIString
				());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #27
0
		public virtual void TestGitWithUserHome()
		{
			string str = "git://example.com/~some/p ath";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.AreEqual("git", u.GetScheme());
			NUnit.Framework.Assert.IsTrue(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("~some/p ath", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("~some/p ath", u.GetPath());
			NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
			NUnit.Framework.Assert.IsNull(u.GetUser());
			NUnit.Framework.Assert.IsNull(u.GetPass());
			NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
			NUnit.Framework.Assert.AreEqual("git://example.com/~some/p ath", u.ToPrivateString
				());
			NUnit.Framework.Assert.AreEqual("git://example.com/~some/p%20ath", u.ToPrivateASCIIString
				());
			NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
			NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateASCIIString(), u.ToASCIIString
				());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #28
0
		public virtual void TestGetSet()
		{
			string str = "ssh://DOMAIN\\user:[email protected]:33/some/p ath%20";
			URIish u = new URIish(str);
			u = u.SetHost(u.GetHost());
			u = u.SetPass(u.GetPass());
			u = u.SetPort(u.GetPort());
			NUnit.Framework.Assert.AreEqual("ssh", u.GetScheme());
			NUnit.Framework.Assert.IsTrue(u.IsRemote());
			u = u.SetRawPath(u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("/some/p ath%20", u.GetRawPath());
			u = u.SetPath(u.GetPath());
			NUnit.Framework.Assert.AreEqual("/some/p ath ", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("/some/p ath ", u.GetPath());
			NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
			NUnit.Framework.Assert.AreEqual("DOMAIN\\user", u.GetUser());
			NUnit.Framework.Assert.AreEqual("pass", u.GetPass());
			NUnit.Framework.Assert.AreEqual(33, u.GetPort());
			NUnit.Framework.Assert.AreEqual("ssh://DOMAIN\\user:[email protected]:33/some/p ath "
				, u.ToPrivateString());
			NUnit.Framework.Assert.AreEqual("ssh://DOMAIN\\user:[email protected]:33/some/p%20ath%20"
				, u.ToPrivateASCIIString());
			NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
			NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateASCIIString(), u.ToASCIIString
				());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #29
0
		public virtual void TestUnixFile()
		{
			string str = "/home/m y";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.IsNull(u.GetScheme());
			NUnit.Framework.Assert.IsFalse(u.IsRemote());
			NUnit.Framework.Assert.AreEqual(str, u.GetRawPath());
			NUnit.Framework.Assert.AreEqual(str, u.GetPath());
			NUnit.Framework.Assert.AreEqual(str, u.ToString());
			NUnit.Framework.Assert.AreEqual(str, u.ToASCIIString());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #30
0
		public virtual void TestPathSeparator()
		{
			string str = "http://*****:*****@host.xy:80/some%2Fpath";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.AreEqual("http", u.GetScheme());
			NUnit.Framework.Assert.IsTrue(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("/some%2Fpath", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("/some/path", u.GetPath());
			NUnit.Framework.Assert.AreEqual("host.xy", u.GetHost());
			NUnit.Framework.Assert.AreEqual(80, u.GetPort());
			NUnit.Framework.Assert.AreEqual("user", u.GetUser());
			NUnit.Framework.Assert.AreEqual("secret", u.GetPass());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #31
0
		public virtual void TestUNC()
		{
			string str = "\\\\some\\place";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.IsNull(u.GetScheme());
			NUnit.Framework.Assert.IsFalse(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("\\\\some\\place", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("\\\\some\\place", u.GetPath());
			NUnit.Framework.Assert.AreEqual("\\\\some\\place", u.ToString());
			NUnit.Framework.Assert.AreEqual("\\\\some\\place", u.ToASCIIString());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #32
0
		public virtual void TestSshProtoWithEscapedADUserPassAndPort()
		{
			string str = "ssh://DOMAIN%5c\u00fcser:[email protected]:33/some/p ath";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.AreEqual("ssh", u.GetScheme());
			NUnit.Framework.Assert.IsTrue(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("/some/p ath", u.GetPath());
			NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
			NUnit.Framework.Assert.AreEqual("DOMAIN\\\u00fcser", u.GetUser());
			NUnit.Framework.Assert.AreEqual("pass", u.GetPass());
			NUnit.Framework.Assert.AreEqual(33, u.GetPort());
			NUnit.Framework.Assert.AreEqual("ssh://DOMAIN\\\u00fcser:[email protected]:33/some/p ath"
				, u.ToPrivateString());
			NUnit.Framework.Assert.AreEqual("ssh://DOMAIN\\%c3%bcser:[email protected]:33/some/p%20ath"
				, u.ToPrivateASCIIString());
			NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
			NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateASCIIString(), u.ToASCIIString
				());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #33
0
		public virtual void TestWindowsFile2()
		{
			string str = "D:\\m y";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.IsNull(u.GetScheme());
			NUnit.Framework.Assert.IsFalse(u.IsRemote());
			NUnit.Framework.Assert.AreEqual("D:\\m y", u.GetRawPath());
			NUnit.Framework.Assert.AreEqual("D:\\m y", u.GetPath());
			NUnit.Framework.Assert.AreEqual("D:\\m y", u.ToString());
			NUnit.Framework.Assert.AreEqual("D:\\m y", u.ToASCIIString());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}
Beispiel #34
0
		public virtual void TestRelativePath()
		{
			string str = "../../foo/bar";
			URIish u = new URIish(str);
			NUnit.Framework.Assert.IsNull(u.GetScheme());
			NUnit.Framework.Assert.IsFalse(u.IsRemote());
			NUnit.Framework.Assert.AreEqual(str, u.GetRawPath());
			NUnit.Framework.Assert.AreEqual(str, u.GetPath());
			NUnit.Framework.Assert.AreEqual(str, u.ToString());
			NUnit.Framework.Assert.AreEqual(str, u.ToASCIIString());
			NUnit.Framework.Assert.AreEqual(u, new URIish(str));
		}