コード例 #1
0
        public void TestGetPotentialRepoUri()
        {
            // Case 1: Repo name and ID both match
            var uri = _source.GetPotentialRepoUri(_normalRepo.RepoID, _normalRepo.RepoName, _progress);

            Assert.AreEqual(_chorusHubURL + _normalRepo.RepoName, uri);

            // Case 2: Repo ID matches, but name does not
            uri = _source.GetPotentialRepoUri(_normalRepo.RepoID, "DifferentProjectName", _progress);
            Assert.AreEqual(_chorusHubURL + _normalRepo.RepoName, uri);

            // Case 3: There is a new repo with the correct name
            uri = _source.GetPotentialRepoUri("AnyIDWillDo", _newRepo.RepoName, _progress);
            Assert.AreEqual(_chorusHubURL + _newRepo.RepoName, uri);

            // Case 4: There is a new repo with a properly-derived name
            uri = _source.GetPotentialRepoUri("AnyIDWillDo", _duplicateRepo.RepoName, _progress);
            Assert.AreEqual(_chorusHubURL + _newRepo.RepoName, uri);

            // Case 5: There is no matching repo
            uri = _source.GetPotentialRepoUri("DoesNotExist", "DoesNotExist", _progress);
            Assert.AreEqual(_chorusHubURL + "DoesNotExist", uri);

            // Case 6: We are cloning a new repo and can't calculate the ID locally yet
            var progress = new ProgressForTest();

            uri = _source.GetPotentialRepoUri(null, null, progress);
            Assert.AreEqual(_chorusHubURL + RepositoryAddress.ProjectNameVariable, uri);
            Assert.IsEmpty(progress.Warnings);
        }
コード例 #2
0
        public void TestGetPotentialRepoUri()
        {
            // Case 1: Repo name and ID both match
            var uri = _source.GetPotentialRepoUri(_normalRepo.RepoID, _normalRepo.RepoName, _progress);

            Assert.AreEqual(_chorusHubURL + _normalRepo.RepoName, uri);

            // Case 2: Repo ID matches, but name does not
            uri = _source.GetPotentialRepoUri(_normalRepo.RepoID, "DifferentProjectName", _progress);
            Assert.AreEqual(_chorusHubURL + _normalRepo.RepoName, uri);

            // Case 3: There is a new repo with the correct name
            uri = _source.GetPotentialRepoUri("AnyIDWillDo", _newRepo.RepoName, _progress);
            Assert.AreEqual(_chorusHubURL + _newRepo.RepoName, uri);

            // Case 4: There is a new repo with a properly-derived name
            uri = _source.GetPotentialRepoUri("AnyIDWillDo", _duplicateRepo.RepoName, _progress);
            Assert.AreEqual(_chorusHubURL + _newRepo.RepoName, uri);

            // Case 5: There is no matching repo
            uri = _source.GetPotentialRepoUri("DoesNotExist", "DoesNotExist", _progress);
            Assert.AreEqual(_chorusHubURL + "DoesNotExist", uri);
        }