public void GetSourceIndexForFile() { var provider = new VaultVersionControlProvider("%VCS_EXECUTABLE%"); var args = new VersionControlArguments { Credentials = new NetworkCredential("Username", "Password"), DestinationPath = @"D:\Source\", Project = "ProjectName", Provider = "Vault", Server = "Server:Port", SourcePath = "$/ProjectName/SourcePath", Label = "My Label" }; var indexer = new SourceIndexer(provider, args); Assert.AreEqual(@"D:\Source\ProjectName\SourcePath\File.ext*/ProjectName/SourcePath*My Label", indexer.GetVersionIndexForFile(@"d:\Source\ProjectName\SourcePath\File.ext"), ignoreCase: true); Assert.AreEqual(@"D:\Source\ProjectName\SourcePath\File.ext*/ProjectName/SourcePath*My Label", indexer.GetVersionIndexForFile(@"D:\Source\ProjectName\SourcePath\File.ext"), ignoreCase: true); }
public void GetVersionIndexForFile() { var provider = new Mock<BaseCommandLineVersionControlProvider>(); provider.Setup(controlProvider => controlProvider.BuildCommandLineArguments(It.IsAny<VersionControlArguments>())) .Returns("args"); provider.Setup(versionControlProvider => versionControlProvider .MapVersionControlSourcePath(It.IsAny<string>(), It.IsAny<VersionControlArguments>())) .Returns("/MyProject/SubFolder"); var args = new VersionControlArguments { Credentials = new NetworkCredential("username", "password"), DestinationPath = "D:\\WorkingFolder\\MyProject", Label = "My Label", Operation = VersionControlOperation.Get, Project = "MyProject", Provider = "Vault", Server = "server:port", SourcePath = "$/MyProject" }; var indexer = new SourceIndexer(provider.Object, args); var line = indexer.GetVersionIndexForFile("D:\\WorkingFolder\\MyProject\\SubFolder\\FileName.ext"); Assert.AreEqual("D:\\WorkingFolder\\MyProject\\SubFolder\\FileName.ext*/MyProject/SubFolder*My Label", line, ignoreCase: true); }