CmisSync.Lib.PathMatcher.PathMatcher.CanCreateLocalPath C# (CSharp) Метод

CanCreateLocalPath() публичный Метод

Determines whether this instance can create local path for specified remotePath.
public CanCreateLocalPath ( string remotePath ) : bool
remotePath string Remote path.
Результат bool
        public bool CanCreateLocalPath(string remotePath)
        {
            if(!remotePath.EndsWith("/")) {
                remotePath += "/";
            }

            return remotePath.StartsWith(this.RemoteTargetRootPath);
        }

Same methods

PathMatcher::CanCreateLocalPath ( IDocument remoteDocument ) : bool
PathMatcher::CanCreateLocalPath ( IFolder remoteFolder ) : bool

Usage Example

Пример #1
0
 public void CanCreateLocalPathTest()
 {
     string remote = this.remotepath + "/test";
     string wrong = "/wrong/path/on/server/test";
     var matcher = new PathMatcher(this.localpath, this.remotepath);
     Assert.IsTrue(matcher.CanCreateLocalPath(this.remotepath));
     Assert.IsTrue(matcher.CanCreateLocalPath(remote));
     Assert.IsFalse(matcher.CanCreateLocalPath(wrong));
     var remoteFolder = new Mock<IFolder>();
     remoteFolder.Setup(f => f.Path).Returns(this.remotepath + "/test2");
     Assert.IsTrue(matcher.CanCreateLocalPath(remoteFolder.Object));
     var wrongFolder = new Mock<IFolder>();
     wrongFolder.Setup(f => f.Path).Returns(wrong + "/test2");
     Assert.IsFalse(matcher.CanCreateLocalPath(wrongFolder.Object));
 }