コード例 #1
0
ファイル: RepositoryAddress.cs プロジェクト: sillsdev/chorus
        /// <summary>
        /// Determines whether a repository is a potential match for the project name. The repository must not be null.
        /// </summary>
        /// <param name="repoInfo"></param>
        /// <param name="projectName"></param>
        /// <returns>
        /// true iff the repository's name begins with the project name followed by only a number
        /// </returns>
        private static bool IsMatchingName(RepositoryInformation repoInfo, string projectName)
        {
            int dummy;

            return(repoInfo.RepoName.StartsWith(projectName) &&
                   int.TryParse(repoInfo.RepoName.Substring(projectName.Length), out dummy));
        }
コード例 #2
0
        public void SetUp()
        {
            // represents a normal repo
            _normalRepo = new RepositoryInformation("AnotherProjectName", "RepoId1");
            // represents a repo that already exists when a project with the same name is added
            _duplicateRepo = new RepositoryInformation("DuplicateProject", "RepoId3");
            // represents a new repo with the same name as the project being added;
            // also represents a new repo with a name derived from the name of the duplicate project
            _newRepo = new RepositoryInformation("DuplicateProject2", RepositoryInformation.NEW_REPO);

            _repositoryInformations = new List<RepositoryInformation>
                {
                    new RepositoryInformation("ProjectName", "RepoId"),
                    _normalRepo,
                    new RepositoryInformation("DifferentProjectName", "RepoId2"),
                    _duplicateRepo,
                    new RepositoryInformation("DuplicateProject1", "RepoId4"),
                    new RepositoryInformation("DuplicateProjectNot", RepositoryInformation.NEW_REPO),
                    _newRepo
                };

            _source = new ChorusHubRepositorySource("localhost",
                _chorusHubURL + RepositoryAddress.ProjectNameVariable,
                false, _repositoryInformations);
        }
コード例 #3
0
 /// <summary>
 /// Determines whether a repository is a potential match for the project name. The repository must not be null.
 /// </summary>
 /// <param name="repoInfo"></param>
 /// <param name="projectName"></param>
 /// <returns>
 /// true iff the repository's name begins with the project name followed by only a number
 /// </returns>
 private static bool IsMatchingName(RepositoryInformation repoInfo, string projectName)
 {
     int dummy;
     return repoInfo.RepoName.StartsWith(projectName)
            && int.TryParse(repoInfo.RepoName.Substring(projectName.Length), out dummy);
 }
コード例 #4
0
 // Allows us to access and test the private method
 private static bool InvokeIsMatchingName(RepositoryInformation repoInfo, string projectName)
 {
     return (bool)typeof(ChorusHubRepositorySource).InvokeMember("IsMatchingName", BindingFlags.DeclaredOnly |
              BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.InvokeMethod,
             null, null, new object[] { repoInfo, projectName });
 }