public void GetRelativeUriTo_FileToDirectory_ReturnsNodesFileName() { var fileInfo = new FileInfo(@"c:\temp\test1.html"); var node = new FolderDirectoryTreeNode(fileInfo, "../"); string relative = node.GetRelativeUriTo(new Uri(@"file:///c:/temp/")); Assert.AreEqual("test1.html", relative); }
public void GetRelativeUriTo_DirectoryToFileOutside_ReturnsRelativePath() { var directoryInfo = new DirectoryInfo(@"c:\temp"); var node = new FolderDirectoryTreeNode(directoryInfo, "../"); string relative = node.GetRelativeUriTo(new Uri(@"file:///c:/temp2/test2.html")); Assert.AreEqual("../temp/", relative); }
public void GetRelativeUriTo_DirectoryToParentDirectory_ReturnsRelativePath() { var directoryInfo = new DirectoryInfo(@"c:\temp\child"); var node = new FolderDirectoryTreeNode(directoryInfo, "../"); string relative = node.GetRelativeUriTo(new Uri(@"file:///c:/temp/")); Assert.AreEqual("child/", relative); }
public void RealData() { var originalLocation = new DirectoryInfo( @"C:\tfs\Dev.CAX\src\CAX_Main\src\net\Projects\Aim.Gain.GoldenCopy.FunctionalTesting\CAX\DistributionOfRights"); var node = new FolderDirectoryTreeNode(originalLocation, ""); var other = new Uri( "file:///C:/tfs/Dev.CAX/src/CAX_Main/src/net/Projects/Aim.Gain.GoldenCopy.FunctionalTesting/CAX/"); string relative = node.GetRelativeUriTo(other); Assert.AreEqual("DistributionOfRights/", relative); }