public void Path_NormalizePathSharp() { Assert.That(SvnTools.GetNormalizedFullPath("c:\\a\\..\\123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\"), Is.EqualTo("C:\\123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890")); Assert.That(SvnTools.GetNormalizedFullPath("C:\\123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"), Is.EqualTo("C:\\123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"), "Shortcut route via IsNormalized"); Assert.That(SvnTools.GetNormalizedDirectoryName("C:\\asdasdashdadhjadjahjdhasjhajhfasdjsdf\\sdsdfsdfsdfgsdjhfsda hjsdsdf sdaf\\sad sad sad f\\"), Is.EqualTo("C:\\asdasdashdadhjadjahjdhasjhajhfasdjsdf\\sdsdfsdfsdfgsdjhfsda hjsdsdf sdaf")); Assert.That(SvnTools.GetNormalizedDirectoryName("C:\\"), Is.Null); Assert.That(SvnTools.GetNormalizedDirectoryName("C:\\\\"), Is.Null); string drive = Environment.CurrentDirectory.Substring(0, 2).ToLowerInvariant(); Assert.That(SvnTools.GetNormalizedDirectoryName(drive), Is.EqualTo(drive.ToUpperInvariant() + Path.GetDirectoryName(Environment.CurrentDirectory).Substring(2))); // CWD on current drive Assert.That(SvnTools.GetNormalizedDirectoryName("C:\\"), Is.Null); Assert.That(SvnTools.GetNormalizedDirectoryName("C:\\\\"), Is.Null); Assert.That(SvnTools.GetNormalizedDirectoryName("c:\\a"), Is.EqualTo("C:\\")); Assert.That(Path.GetDirectoryName(@"\\Server\Share\Path"), Is.EqualTo(@"\\Server\Share")); Assert.That(Path.GetDirectoryName(@"\\Server\Share"), Is.Null); Assert.That(Path.GetDirectoryName(@"C:\Dir\Sub\"), Is.EqualTo(@"C:\Dir\Sub")); Assert.That(Path.GetDirectoryName(@"C:\Dir\Sub"), Is.EqualTo(@"C:\Dir")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"\\Server\Share\Path"), Is.EqualTo(@"\\server\Share")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"\\Server\Share"), Is.Null); Assert.That(Path.GetDirectoryName(@"\\server\c$"), Is.Null); Assert.That(Path.GetDirectoryName(@"\\server\c$\\"), Is.EqualTo(@"\\server\c$")); Assert.That(SvnTools.GetNormalizedFullPath(@"\\server\c$"), Is.EqualTo(@"\\server\c$")); Assert.That(SvnTools.GetNormalizedFullPath(@"\\seRver\c$\"), Is.EqualTo(@"\\server\c$")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"\\server\c$"), Is.Null); Assert.That(SvnTools.GetNormalizedDirectoryName(@"\\server\c$\\"), Is.Null); Assert.That(SvnTools.GetNormalizedDirectoryName(@"\\seRver\c$\\"), Is.Null); string share = @"\\" + Environment.MachineName.ToLowerInvariant() + @"\C$"; string shaUC = @"\\" + Environment.MachineName.ToUpperInvariant() + @"\C$"; Assert.That(SvnTools.IsNormalizedFullPath(share)); Assert.That(!SvnTools.IsNormalizedFullPath(shaUC)); Assert.That(!SvnTools.IsNormalizedFullPath(share + "\\")); Assert.That(!SvnTools.IsNormalizedFullPath(shaUC + "\\")); Assert.That(SvnTools.GetTruePath(share + "\\A\\B", true), Is.EqualTo(share + "\\A\\B")); Assert.That(SvnTools.GetTruePath(share + "\\A", true), Is.EqualTo(share + "\\A")); Assert.That(SvnTools.GetTruePath(share, true), Is.EqualTo(share)); Assert.That(SvnTools.GetTruePath(share + "\\", true), Is.EqualTo(share)); Assert.That(SvnTools.GetTruePath("C:\\A", true), Is.EqualTo("C:\\A")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"C:\dir"), Is.EqualTo(@"C:\")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"c:\dir"), Is.EqualTo(@"C:\")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"C:\dir\\"), Is.EqualTo(@"C:\")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"c:\dir\\"), Is.EqualTo(@"C:\")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"C:\sub\dir"), Is.EqualTo(@"C:\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"c:\sub\dir"), Is.EqualTo(@"C:\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"C:\sub\dir\\"), Is.EqualTo(@"C:\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"c:\sub\dir\\"), Is.EqualTo(@"C:\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"C:\dir"), Is.EqualTo(@"C:\")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"c:\dir"), Is.EqualTo(@"C:\")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"C:\dir\\"), Is.EqualTo(@"C:\")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"c:\dir\\"), Is.EqualTo(@"C:\")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"C:\sub\dir"), Is.EqualTo(@"C:\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"c:\sub\dir"), Is.EqualTo(@"C:\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"C:\sub\dir\\"), Is.EqualTo(@"C:\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(@"c:\sub\dir\\"), Is.EqualTo(@"C:\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(share + @"\dir"), Is.EqualTo(share)); Assert.That(SvnTools.GetNormalizedDirectoryName(shaUC + @"\dir"), Is.EqualTo(share)); Assert.That(SvnTools.GetNormalizedDirectoryName(share + @"\dir\\"), Is.EqualTo(share)); Assert.That(SvnTools.GetNormalizedDirectoryName(shaUC + @"\dir\\"), Is.EqualTo(share)); Assert.That(SvnTools.GetNormalizedDirectoryName(share + @"\sub\dir"), Is.EqualTo(share + @"\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(shaUC + @"\sub\dir"), Is.EqualTo(share + @"\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(share + @"\sub\dir\\"), Is.EqualTo(share + @"\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(shaUC + @"\sub\dir\\"), Is.EqualTo(share + @"\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(share + @"\dir"), Is.EqualTo(share)); Assert.That(SvnTools.GetNormalizedDirectoryName(shaUC + @"\dir"), Is.EqualTo(share)); Assert.That(SvnTools.GetNormalizedDirectoryName(share + @"\dir\\"), Is.EqualTo(share)); Assert.That(SvnTools.GetNormalizedDirectoryName(shaUC + @"\dir\\"), Is.EqualTo(share)); Assert.That(SvnTools.GetNormalizedDirectoryName(share + @"\sub\dir"), Is.EqualTo(share + @"\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(shaUC + @"\sub\dir"), Is.EqualTo(share + @"\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(share + @"\sub\dir\\"), Is.EqualTo(share + @"\sub")); Assert.That(SvnTools.GetNormalizedDirectoryName(shaUC + @"\sub\dir\\"), Is.EqualTo(share + @"\sub")); Assert.That(SvnTools.GetNormalizedFullPath("c:\\"), Is.EqualTo("C:\\")); Assert.That(SvnTools.GetNormalizedFullPath("C:\\"), Is.EqualTo("C:\\")); Assert.That(SvnTools.GetNormalizedFullPath("C:"), Is.StringStarting("C:\\")); Assert.That(SvnTools.GetNormalizedFullPath("c:"), Is.StringStarting("C:\\")); }