Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 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());
 }
Ejemplo n.º 3
0
 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());
 }
Ejemplo n.º 4
0
 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());
 }
Ejemplo n.º 5
0
 public void TestRelativeToCurrentPath()
 {
     var path1 = new UPath("../file.cs");
     var path2 = new UPath(".");
     Assert.AreEqual(".." + Path.DirectorySeparatorChar + "file.cs", path2.MakeRelativeUPath(path1).ToString());
 }
Ejemplo n.º 6
0
 public void TestRelativeToRelativePathNotResolvable()
 {
     var path1 = new UPath("FileNotExists.cs");
     var path2 = new UPath("../NotExisting");
     var res = path2.MakeRelativeUPath(path1).ToString();
 }
Ejemplo n.º 7
0
 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());
 }
Ejemplo n.º 8
0
 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());
 }
Ejemplo n.º 9
0
 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());
 }
Ejemplo n.º 10
0
 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());
 }
Ejemplo n.º 11
0
 public void TestRelativePath2()
 {
     var path1 = new UPath("..\\mydir\\file.cs");
     var path2 = new UPath("../mydir/");
     Assert.AreEqual("file.cs", path2.MakeRelativeUPath(path1).ToString());
 }
Ejemplo n.º 12
0
 public void TestAbsoluteWithDifferentDrives()
 {
     var path1 = new UPath(@"D:\FileNotExists.cs");
     var path2 = new UPath(@"C:\NotExisting");
     var res = path2.MakeRelativeUPath(path1).ToString();
 }
Ejemplo n.º 13
0
 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());
 }