Пример #1
0
        public void Path_UncLocalDriveTests()
        {
            string sysDir   = SvnTools.GetTruePath(System.Environment.GetFolderPath(Environment.SpecialFolder.System));
            string testPath = "\\\\" + Environment.MachineName.ToLowerInvariant() + "\\" + sysDir[0] + "$" + sysDir.Substring(2);

            Assert.That(SvnTools.IsAbsolutePath(testPath));

            Assert.That(SvnTools.GetNormalizedFullPath(testPath), Is.EqualTo(testPath), "Fetch normalized");
            Assert.That(new SvnPathTarget(testPath).TargetName, Is.EqualTo(testPath), "PathTarget");

            Assert.That(SvnTools.GetTruePath(testPath, true), Is.EqualTo(testPath), "Fetch truepath");
        }
Пример #2
0
        public void Path_TestNormalizationTesters()
        {
            Assert.That(SvnTools.IsNormalizedFullPath("a:\\"), Is.False, "a:\\ is not normalized");
            Assert.That(SvnTools.IsNormalizedFullPath("A:\\"), Is.True, "A:\\ is normalized");
            Assert.That(SvnTools.IsNormalizedFullPath("A:\\\\"), Is.False, "A:\\\\ is not normalized");
            Assert.That(SvnTools.IsNormalizedFullPath("A:\\.\\"), Is.False);
            Assert.That(SvnTools.IsNormalizedFullPath("A:\\..\\"), Is.False);
            Assert.That(SvnTools.IsNormalizedFullPath("A:\\...\\"), Is.False);
            Assert.That(SvnTools.IsNormalizedFullPath("A:\\..."), Is.False);
            Assert.That(SvnTools.IsNormalizedFullPath("A:\\.svn"), Is.True);
            Assert.That(SvnTools.IsNormalizedFullPath("A:\\.svn\\"), Is.False);
            Assert.That(SvnTools.IsNormalizedFullPath("A:\\\\t.svn"), Is.False);
            Assert.That(SvnTools.IsNormalizedFullPath("A:\\.....svn"), Is.True);

            Assert.That(SvnTools.GetTruePath("c:\\"), Is.EqualTo("C:\\"));
            Assert.That(SvnTools.GetTruePath("c:\\" + Guid.NewGuid()), Is.Null);
            Assert.That(SvnTools.GetTruePath("c:\\-never-exists-", true), Is.Not.Null);

            Assert.That(SvnTools.IsAbsolutePath("a:\\"), Is.True);
            Assert.That(SvnTools.IsAbsolutePath("A:\\"), Is.True);
            Assert.That(SvnTools.IsAbsolutePath("A:\\\\"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath("A:\\B"), Is.True);
            Assert.That(SvnTools.IsAbsolutePath("A:\\B\\"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath("a:/sdfsdfsd"), Is.True);
            Assert.That(SvnTools.IsAbsolutePath("A:\\dfsdfds"), Is.True);

            Assert.That(SvnTools.IsAbsolutePath("a:"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath("A:file"), Is.False);
            Assert.That(Path.IsPathRooted("a:"), Is.True);
            Assert.That(Path.IsPathRooted("A:file"), Is.True);

            Assert.That(SvnTools.IsNormalizedFullPath(@"\\SERVER\path"), Is.False, @"\\SERVER\path");
            Assert.That(SvnTools.IsNormalizedFullPath(@"\\server\path\"), Is.False, @"\\server\path\");
            Assert.That(SvnTools.IsNormalizedFullPath(@"\\server\path"), Is.True, @"\\server\path");
            Assert.That(SvnTools.IsNormalizedFullPath(@"\\server\Path"), Is.True, @"\\server\Path");
            Assert.That(SvnTools.IsNormalizedFullPath(@"\\server\path\file"), Is.True);

            Assert.That(SvnTools.IsAbsolutePath(@"\\\"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath(@"\\server\path"), Is.True);
            Assert.That(SvnTools.IsAbsolutePath(@"\\server\path\"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath(@"\\server\path\\"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath(@"\\server\path\dir"), Is.True);
            Assert.That(SvnTools.IsAbsolutePath(@"\\server\path\dir\"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath(@"\\server\path\dir\\"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath(@"\\server"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath(@"\\server\"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath(@"\\server\\"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath(@"\server"), Is.False);
        }
Пример #3
0
        public void Path_NormalizingPathsDot()
        {
            Assert.That(SvnTools.IsNormalizedFullPath("C:\\source\\."), Is.False);
            Assert.That(SvnTools.IsNormalizedFullPath("C:\\source\\.\\"), Is.False);
            Assert.That(SvnTools.IsNormalizedFullPath("C:\\source\\.\\dump"), Is.False);

            Assert.That(SvnTools.IsAbsolutePath("C:\\source\\."), Is.False);
            Assert.That(SvnTools.IsAbsolutePath("C:\\source\\.\\"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath("C:\\source\\.\\dump"), Is.False);

            Assert.That(SvnPathTarget.FromString("C:\\source\\.").TargetPath, Is.EqualTo("C:\\source"));
            Assert.That(SvnPathTarget.FromString("C:\\source\\.\\").TargetPath, Is.EqualTo("C:\\source"));
            Assert.That(SvnPathTarget.FromString("C:\\source\\.\\dump").TargetPath, Is.EqualTo("C:\\source\\dump"));

            Assert.That(SvnTools.IsNormalizedFullPath("c:\\source"), Is.False);
            Assert.That(SvnTools.IsAbsolutePath("c:\\source"), Is.True);

            Assert.That(SvnPathTarget.FromString("c:\\source\\.").TargetPath, Is.EqualTo("C:\\source"));
            Assert.That(SvnPathTarget.FromString("c:\\source\\.\\").TargetPath, Is.EqualTo("C:\\source"));
            Assert.That(SvnPathTarget.FromString("c:\\source\\.\\dump").TargetPath, Is.EqualTo("C:\\source\\dump"));
        }