Exemple #1
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.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.GetPath());
     NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
     NUnit.Framework.Assert.IsNull(u.GetUser());
     NUnit.Framework.Assert.AreEqual("b.txt", u.GetHumanishName());
 }
Exemple #2
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.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.GetPath());
            NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
            NUnit.Framework.Assert.IsNull(u.GetUser());
            NUnit.Framework.Assert.AreEqual("b.txt", u.GetHumanishName());
        }