コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }