コード例 #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);
        }
コード例 #2
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));
        }
コード例 #3
0
        public void GetRootFolderRelativePathWithoutTrailingDenominator()
        {
            var matcher = new PathMatcher(Path.GetTempPath(), "/tmp");

            Assert.That(matcher.GetRelativeLocalPath(Path.GetTempPath().TrimEnd(Path.DirectorySeparatorChar)), Is.EqualTo("."));
        }