public void ReproduceUnixRelativePathNotOnTheSameDrive() { var unixPath = @"/usr/local/teamcity-agent/work/6c86e2555ed64afc/Lx.Tools/Lx.Tools.Projects/Lx.Tools.Projects.Tests/bin/Debug"; var winPath = @"C:\usr\local\teamcity-agent\work\6c86e2555ed64afc\Lx.Tools\Lx.Tools.Projects\Lx.Tools.Projects.Tests\bin\Debug\..\..\Lx.Tools.Projects.Tests.csproj"; var path1 = new UPath(unixPath); var path2 = new UPath(winPath); var res = path1.MakeRelativeUPath(path2); }
public void TestAbsoluteToAbsolutePath2() { var path1 = new UPath(new FileInfo("../../Properties/AssemblyInfo.cs").FullName); var path2 = new UPath(new DirectoryInfo("../../").FullName); Assert.AreEqual("Properties" + Path.DirectorySeparatorChar + "AssemblyInfo.cs", path2.MakeRelativeUPath(path1).ToString()); }
public void TestWinVsUnixRoots() { var path1 = new UPath(_winCurDir.Replace('\\', '/') + "/root.cs"); var path2 = new UPath(_winCurDir.Replace('/', '\\')); Assert.AreEqual("root.cs", path2.MakeRelativeUPath(path1).ToString()); }
public void TestAbsoluteToAbsolutePath() { var path1 = new UPath(new FileInfo("../../UPath.cs").FullName); var path2 = new UPath(new DirectoryInfo("../../").FullName); Assert.AreEqual("UPath.cs", path2.MakeRelativeUPath(path1).ToString()); }
public void TestRelativeToCurrentPath() { var path1 = new UPath("../file.cs"); var path2 = new UPath("."); Assert.AreEqual(".." + Path.DirectorySeparatorChar + "file.cs", path2.MakeRelativeUPath(path1).ToString()); }
public void TestRelativeToRelativePathNotResolvable() { var path1 = new UPath("FileNotExists.cs"); var path2 = new UPath("../NotExisting"); var res = path2.MakeRelativeUPath(path1).ToString(); }
public void TestRelativePathInCurrentDir() { var path1 = new UPath("mydir\\dir2\\file.cs"); var path2 = new UPath("mydir"); Assert.AreEqual("dir2/file.cs".Replace('/', Path.DirectorySeparatorChar), path2.MakeRelativeUPath(path1).ToString()); }
public void TestRelativeToAbsolutePath() { var path1 = new UPath("../file.cs"); var path2 = new UPath(_winCurDir); Assert.AreEqual("../file.cs".Replace('/', Path.DirectorySeparatorChar), path2.MakeRelativeUPath(path1).ToString()); }
public void TestRelativePath5() { var path1 = new UPath("..\\dir1\\dir2\\dir3\\file.cs"); var path2 = new UPath("../dir1/dir2"); Assert.AreEqual("dir3" + Path.DirectorySeparatorChar + "file.cs", path2.MakeRelativeUPath(path1).ToString()); }
public void TestRelativePath4() { var path1 = new UPath("..\\dir1\\dir2\\dir3\\file.cs"); var path2 = new UPath("../dir1/dir2/dir3"); Assert.AreEqual("file.cs", path2.MakeRelativeUPath(path1).ToString()); }
public void TestRelativePath2() { var path1 = new UPath("..\\mydir\\file.cs"); var path2 = new UPath("../mydir/"); Assert.AreEqual("file.cs", path2.MakeRelativeUPath(path1).ToString()); }
public void TestAbsoluteWithDifferentDrives() { var path1 = new UPath(@"D:\FileNotExists.cs"); var path2 = new UPath(@"C:\NotExisting"); var res = path2.MakeRelativeUPath(path1).ToString(); }
public void TestAbsoluteToAbsolutePathWithADifferentDirectory() { var path1 = new UPath(new FileInfo("../../UPath.cs").FullName); var path2 = new UPath(new DirectoryInfo("../../Properties").FullName); Assert.AreEqual(".." + Path.DirectorySeparatorChar + "UPath.cs", path2.MakeRelativeUPath(path1).ToString()); }