コード例 #1
0
        public void CrossPathCreatingTest()
        {
            var    matcher = new PathMatcher(this.localpath, this.remotepath);
            string result  = matcher.CreateRemotePath(this.localpath);

            AssertPathEqual(this.remotepath, result);
            result = matcher.CreateLocalPath(result);
            AssertPathEqual(this.localpath, result);

            result = matcher.CreateRemotePath(Path.Combine(this.localpath, "sub"));
            result = matcher.CreateLocalPath(result);
            AssertPathEqual(Path.Combine(this.localpath, "sub"), result);

            result = matcher.CreateLocalPath(this.remotepath + "/sub");
            result = matcher.CreateRemotePath(result);
            AssertPathEqual(this.remotepath + "/sub", result);
        }
コード例 #2
0
        public void CreateRemotePathTest()
        {
            var    matcher = new PathMatcher(this.localpath, this.remotepath);
            string result  = matcher.CreateRemotePath(this.localpath);

            AssertPathEqual(this.remotepath, result);
            string subfolder = "sub";

            result = matcher.CreateRemotePath(Path.Combine(this.localpath, subfolder));
            Assert.AreEqual(this.remotepath + "/" + subfolder, result);
            subfolder = "sub/sub";
            result    = matcher.CreateRemotePath(Path.Combine(this.localpath, "sub", "sub"));
            Assert.AreEqual(this.remotepath + "/" + subfolder, result);
            try
            {
                matcher.CreateRemotePath(Path.Combine("wrong", "folder"));
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }