コード例 #1
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));
        }
コード例 #2
0
        public virtual void TestSshProtoWithADUserPassAndPort()
        {
            string str = "ssh://DOMAIN\\user:[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\\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"
                                            , 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));
        }
コード例 #3
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));
        }
コード例 #4
0
ファイル: URIishTest.cs プロジェクト: ashmind/ngit
        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.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(u.SetPass(null).ToPrivateString(), u.ToString());
            NUnit.Framework.Assert.AreEqual(u, new URIish(str));
        }
コード例 #5
0
ファイル: URIishTest.cs プロジェクト: nnieslan/ngit
 public virtual void TestSshProtoWithUserPassAndPort()
 {
     string str = "ssh://*****:*****@example.com: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.GetPath());
     NUnit.Framework.Assert.AreEqual("example.com", u.GetHost());
     NUnit.Framework.Assert.AreEqual("user", u.GetUser());
     NUnit.Framework.Assert.AreEqual("pass", u.GetPass());
     NUnit.Framework.Assert.AreEqual(33, u.GetPort());
     NUnit.Framework.Assert.AreEqual(str, u.ToPrivateString());
     NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
     NUnit.Framework.Assert.AreEqual(u, new URIish(str));
 }
コード例 #6
0
ファイル: URIishTest.cs プロジェクト: nnieslan/ngit
 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.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(str, u.ToPrivateString());
     NUnit.Framework.Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
     NUnit.Framework.Assert.AreEqual(u, new URIish(str));
 }
コード例 #7
0
ファイル: URIishTest.cs プロジェクト: nnieslan/ngit
 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.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(u.SetPass(null).ToPrivateString(), u.ToString());
     NUnit.Framework.Assert.AreEqual(u, new URIish(str));
 }
コード例 #8
0
		/// <summary>
		/// Constructs an UnsupportedCredentialItem with the specified detail message
		/// prefixed with provided URI.
		/// </summary>
		/// <remarks>
		/// Constructs an UnsupportedCredentialItem with the specified detail message
		/// prefixed with provided URI.
		/// </remarks>
		/// <param name="uri">URI used for transport</param>
		/// <param name="s">message</param>
		public UnsupportedCredentialItem(URIish uri, string s) : base(uri.SetPass(null) +
			 ": " + s)
		{
		}
コード例 #9
0
ファイル: URIishTest.cs プロジェクト: LunarLanding/ngit
		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));
		}
コード例 #10
0
ファイル: URIishTest.cs プロジェクト: LunarLanding/ngit
		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));
		}
コード例 #11
0
ファイル: URIishTest.cs プロジェクト: LunarLanding/ngit
		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));
		}
コード例 #12
0
		/// <summary>
		/// Constructs an TransportException with the specified detail message
		/// prefixed with provided URI.
		/// </summary>
		/// <remarks>
		/// Constructs an TransportException with the specified detail message
		/// prefixed with provided URI.
		/// </remarks>
		/// <param name="uri">URI used for transport</param>
		/// <param name="s">message</param>
		/// <param name="cause">root cause exception</param>
		public TransportException(URIish uri, string s, Exception cause) : this(uri.SetPass
			(null) + ": " + s, cause)
		{
		}
コード例 #13
0
		/// <summary>
		/// Constructs an TransportException with the specified detail message
		/// prefixed with provided URI.
		/// </summary>
		/// <remarks>
		/// Constructs an TransportException with the specified detail message
		/// prefixed with provided URI.
		/// </remarks>
		/// <param name="uri">URI used for transport</param>
		/// <param name="s">message</param>
		public TransportException(URIish uri, string s) : base(uri.SetPass(null) + ": " +
			 s)
		{
		}