Beispiel #1
0
        public virtual void TestRemoveOnlyURI()
        {
            ReadConfig(string.Empty);
            URIish       a  = new URIish("/some/dir");
            RemoteConfig rc = new RemoteConfig(config, "backup");

            NUnit.Framework.Assert.IsTrue(rc.AddURI(a));
            NUnit.Framework.Assert.AreEqual(1, rc.URIs.Count);
            NUnit.Framework.Assert.AreSame(a, rc.URIs[0]);
            NUnit.Framework.Assert.IsTrue(rc.RemoveURI(a));
            NUnit.Framework.Assert.AreEqual(0, rc.URIs.Count);
        }
Beispiel #2
0
        public virtual void TestSaveRemoveFirstURI()
        {
            ReadConfig("[remote \"spearce\"]\n" + "url = http://www.spearce.org/egit.git\n" +
                       "url = /some/dir\n" + "fetch = +refs/heads/*:refs/remotes/spearce/*\n");
            RemoteConfig rc = new RemoteConfig(config, "spearce");

            NUnit.Framework.Assert.AreEqual(2, rc.URIs.Count);
            rc.RemoveURI(new URIish("http://www.spearce.org/egit.git"));
            NUnit.Framework.Assert.AreEqual(1, rc.URIs.Count);
            rc.Update(config);
            CheckConfig("[remote \"spearce\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/spearce/*\n"
                        );
        }
Beispiel #3
0
        public virtual void TestRemoveLastURI()
        {
            ReadConfig(string.Empty);
            URIish       a  = new URIish("/some/dir");
            URIish       b  = new URIish("/another/dir");
            URIish       c  = new URIish("/more/dirs");
            RemoteConfig rc = new RemoteConfig(config, "backup");

            NUnit.Framework.Assert.IsTrue(rc.AddURI(a));
            NUnit.Framework.Assert.IsTrue(rc.AddURI(b));
            NUnit.Framework.Assert.IsTrue(rc.AddURI(c));
            NUnit.Framework.Assert.AreEqual(3, rc.URIs.Count);
            NUnit.Framework.Assert.AreSame(a, rc.URIs[0]);
            NUnit.Framework.Assert.AreSame(b, rc.URIs[1]);
            NUnit.Framework.Assert.AreSame(c, rc.URIs[2]);
            NUnit.Framework.Assert.IsTrue(rc.RemoveURI(c));
            NUnit.Framework.Assert.AreEqual(2, rc.URIs.Count);
            NUnit.Framework.Assert.AreSame(a, rc.URIs[0]);
            NUnit.Framework.Assert.AreSame(b, rc.URIs[1]);
        }
Beispiel #4
0
		public virtual void TestSaveRemoveFirstURI()
		{
			ReadConfig("[remote \"spearce\"]\n" + "url = http://www.spearce.org/egit.git\n" +
				 "url = /some/dir\n" + "fetch = +refs/heads/*:refs/remotes/spearce/*\n");
			RemoteConfig rc = new RemoteConfig(config, "spearce");
			NUnit.Framework.Assert.AreEqual(2, rc.URIs.Count);
			rc.RemoveURI(new URIish("http://www.spearce.org/egit.git"));
			NUnit.Framework.Assert.AreEqual(1, rc.URIs.Count);
			rc.Update(config);
			CheckConfig("[remote \"spearce\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/spearce/*\n"
				);
		}
Beispiel #5
0
		public virtual void TestRemoveOnlyURI()
		{
			ReadConfig(string.Empty);
			URIish a = new URIish("/some/dir");
			RemoteConfig rc = new RemoteConfig(config, "backup");
			NUnit.Framework.Assert.IsTrue(rc.AddURI(a));
			NUnit.Framework.Assert.AreEqual(1, rc.URIs.Count);
			NUnit.Framework.Assert.AreSame(a, rc.URIs[0]);
			NUnit.Framework.Assert.IsTrue(rc.RemoveURI(a));
			NUnit.Framework.Assert.AreEqual(0, rc.URIs.Count);
		}
Beispiel #6
0
		public virtual void TestRemoveLastURI()
		{
			ReadConfig(string.Empty);
			URIish a = new URIish("/some/dir");
			URIish b = new URIish("/another/dir");
			URIish c = new URIish("/more/dirs");
			RemoteConfig rc = new RemoteConfig(config, "backup");
			NUnit.Framework.Assert.IsTrue(rc.AddURI(a));
			NUnit.Framework.Assert.IsTrue(rc.AddURI(b));
			NUnit.Framework.Assert.IsTrue(rc.AddURI(c));
			NUnit.Framework.Assert.AreEqual(3, rc.URIs.Count);
			NUnit.Framework.Assert.AreSame(a, rc.URIs[0]);
			NUnit.Framework.Assert.AreSame(b, rc.URIs[1]);
			NUnit.Framework.Assert.AreSame(c, rc.URIs[2]);
			NUnit.Framework.Assert.IsTrue(rc.RemoveURI(c));
			NUnit.Framework.Assert.AreEqual(2, rc.URIs.Count);
			NUnit.Framework.Assert.AreSame(a, rc.URIs[0]);
			NUnit.Framework.Assert.AreSame(b, rc.URIs[1]);
		}