public Matches ( IDirectoryInfo localFolder, IFolder remoteFolder ) : bool | ||
localFolder | IDirectoryInfo | Local folder. |
remoteFolder | IFolder | Remote folder. |
return | bool |
public void MatchesTest() { var matcher = new PathMatcher(this.localpath, this.remotepath); Assert.IsTrue(matcher.Matches(this.localpath, this.remotepath)); string sameSubfolder = "bla"; Assert.IsTrue(matcher.Matches(Path.Combine(this.localpath, sameSubfolder), this.remotepath + "/" + sameSubfolder)); sameSubfolder = Path.Combine("sub", "folder"); Assert.IsTrue(matcher.Matches(Path.Combine(this.localpath, sameSubfolder), this.remotepath + "/" + sameSubfolder)); string anotherFolder = "another"; Assert.IsFalse(matcher.Matches(Path.Combine(this.localpath, sameSubfolder), this.remotepath + "/" + anotherFolder)); string subfolderOfSame = Path.Combine(sameSubfolder, "sub"); Assert.IsFalse(matcher.Matches(Path.Combine(this.localpath, sameSubfolder), this.remotepath + "/" + subfolderOfSame)); Assert.IsFalse(matcher.Matches(Path.Combine(this.localpath, subfolderOfSame), this.remotepath + "/" + sameSubfolder)); string wrongStartingFolder = "wrong"; try { matcher.Matches(Path.Combine(this.localpath, wrongStartingFolder), wrongStartingFolder); Assert.Fail("Should throw exception on wrong path start"); } catch (ArgumentOutOfRangeException) { } try { matcher.Matches(wrongStartingFolder, wrongStartingFolder); Assert.Fail("Should throw exception on wrong path start"); } catch (ArgumentOutOfRangeException) { } try { matcher.Matches(wrongStartingFolder, this.remotepath + "/" + wrongStartingFolder); Assert.Fail("Should throw exception on wrong path start"); } catch (ArgumentOutOfRangeException) { } }