GetRelativeLocalPath() public method

Gets the relative local path.
public GetRelativeLocalPath ( string localPath ) : string
localPath string Local path.
return string
Exemplo n.º 1
0
        public void GetRelativePathDoesNotStartWithSlash()
        {
            this.localpath = this.localpath.EndsWith(Path.DirectorySeparatorChar.ToString()) ? this.localpath.Substring(0, this.localpath.Length - 1) : this.localpath;
            var matcher = new PathMatcher(this.localpath, "/");
            string folderName = "new";

            Assert.That(matcher.GetRelativeLocalPath(Path.Combine(this.localpath, folderName)).StartsWith(Path.DirectorySeparatorChar.ToString()), Is.False);
        }
Exemplo n.º 2
0
        public void GetRootFolderRelativePathWithoutTrailingDenominator()
        {
            var matcher = new PathMatcher(Path.GetTempPath(), "/tmp");

            Assert.That(matcher.GetRelativeLocalPath(Path.GetTempPath().TrimEnd(Path.DirectorySeparatorChar)), Is.EqualTo("."));
        }
Exemplo n.º 3
0
        public void GetRelativePath()
        {
            var matcher = new PathMatcher(this.localpath, this.remotepath);
            string folderName = "new";
            string newLocalPath = Path.Combine(this.localpath, folderName);

            Assert.That(matcher.GetRelativeLocalPath(newLocalPath), Is.EqualTo(folderName));
        }