Пример #1
0
 public void test001_WindowsFile2()
 {
     const string str = "D:\\m y";
     URIish u = new URIish(str);
     Assert.IsNull(u.Scheme);
     Assert.IsFalse(u.IsRemote);
     Assert.AreEqual("D:/m y", u.Path);
     Assert.AreEqual("D:/m y", u.ToString());
     Assert.AreEqual(u, new URIish(str));
 }
Пример #2
0
 public void test000_UnixFile()
 {
     const string str = "/home/m y";
     URIish u = new URIish(str);
     Assert.IsNull(u.Scheme);
     Assert.IsFalse(u.IsRemote);
     Assert.AreEqual(str, u.Path);
     Assert.AreEqual(str, u.ToString());
     Assert.AreEqual(u, new URIish(str));
 }
Пример #3
0
        public void testAddURI()
        {
            readConfig(string.Empty);

            URIish uri = new URIish("/some/dir");
            RemoteConfig rc = new RemoteConfig(config, "backup");
            Assert.AreEqual(0, rc.URIs.Count);

            Assert.IsTrue(rc.AddURI(uri));
            Assert.AreEqual(1, rc.URIs.Count);
            Assert.AreSame(uri, rc.URIs[0]);

            Assert.IsFalse(rc.AddURI(new URIish(uri.ToString())));
            Assert.AreEqual(1, rc.URIs.Count);
        }
Пример #4
0
 public void test003_FileProtoUnix()
 {
     const string str = "file:///home/m y";
     URIish u = new URIish(str);
     Assert.AreEqual("file", u.Scheme);
     Assert.False(u.IsRemote);
     Assert.AreEqual("/home/m y", u.Path);
     Assert.AreEqual(str, u.ToString());
     Assert.AreEqual(u, new URIish(str));
 }
Пример #5
0
 public void test002_UNC()
 {
     const string str = "\\\\some\\place";
     URIish u = new URIish(str);
     Assert.Null(u.Scheme);
     Assert.False(u.IsRemote);
     Assert.AreEqual("//some/place", u.Path);
     Assert.AreEqual("//some/place", u.ToString());
     Assert.AreEqual(u, new URIish(str));
 }
Пример #6
0
 public void test015_SshProtoWithUserPassAndPort()
 {
     const string str = "ssh://*****:*****@example.com:33/some/p ath";
     URIish u = new URIish(str);
     Assert.AreEqual("ssh", u.Scheme);
     Assert.True(u.IsRemote);
     Assert.AreEqual("/some/p ath", u.Path);
     Assert.AreEqual("example.com", u.Host);
     Assert.AreEqual("user", u.User);
     Assert.AreEqual("pass", u.Pass);
     Assert.AreEqual(33, u.Port);
     Assert.AreEqual(str, u.ToPrivateString());
     Assert.AreEqual(u.SetPass(null).ToPrivateString(), u.ToString());
     Assert.AreEqual(u, new URIish(str));
 }
Пример #7
0
 public void test013_SshProto()
 {
     const string str = "ssh://example.com/some/p ath";
     URIish u = new URIish(str);
     Assert.AreEqual("ssh", u.Scheme);
     Assert.True(u.IsRemote);
     Assert.AreEqual("/some/p ath", u.Path);
     Assert.AreEqual("example.com", u.Host);
     Assert.AreEqual(-1, u.Port);
     Assert.AreEqual(str, u.ToString());
     Assert.AreEqual(u, new URIish(str));
 }
Пример #8
0
 public void test010_ScpStyleWithUser()
 {
     const string str = "[email protected]:some/p ath";
     URIish u = new URIish(str);
     Assert.Null(u.Scheme);
     Assert.True(u.IsRemote);
     Assert.AreEqual("some/p ath", u.Path);
     Assert.AreEqual("user", u.User);
     Assert.AreEqual("example.com", u.Host);
     Assert.AreEqual(-1, u.Port);
     Assert.AreEqual(str, u.ToString());
     Assert.AreEqual(u, new URIish(str));
 }
Пример #9
0
 public void test008_GitProtoWindows()
 {
     const string str = "git://example.com/D:/m y";
     URIish u = new URIish(str);
     Assert.AreEqual("git", u.Scheme);
     Assert.True(u.IsRemote);
     Assert.AreEqual("D:/m y", u.Path);
     Assert.AreEqual(-1, u.Port);
     Assert.AreEqual("example.com", u.Host);
     Assert.AreEqual(str, u.ToString());
     Assert.AreEqual(u, new URIish(str));
 }
Пример #10
0
 public void test006_GitProtoUnixPort()
 {
     const string str = "git://example.com:333/home/m y";
     URIish u = new URIish(str);
     Assert.AreEqual("git", u.Scheme);
     Assert.True(u.IsRemote);
     Assert.AreEqual("example.com", u.Host);
     Assert.AreEqual("/home/m y", u.Path);
     Assert.AreEqual(333, u.Port);
     Assert.AreEqual(str, u.ToString());
     Assert.AreEqual(u, new URIish(str));
 }
Пример #11
0
 public void test004_FileProtoWindows()
 {
     const string str = "file:///D:/m y";
     URIish u = new URIish(str);
     Assert.AreEqual("file", u.Scheme);
     Assert.False(u.IsRemote);
     Assert.AreEqual("D:/m y", u.Path);
     Assert.AreEqual(str, u.ToString());
     Assert.AreEqual(u, new URIish(str));
 }
Пример #12
0
        public void test007_AddURI()
        {
            writeConfig("");

            URIish uri = new URIish("/some/dir");
            RemoteConfig rc = new RemoteConfig(db.Config, "backup");
            Assert.AreEqual(0, rc.URIs.Count);

            Assert.True(rc.AddURI(uri));
            Assert.AreEqual(1, rc.URIs.Count);
            Assert.AreSame(uri, rc.URIs[0]);

            Assert.False(rc.AddURI(new URIish(uri.ToString())));
            Assert.AreEqual(1, rc.URIs.Count);
        }