Пример #1
0
        public void AddRepository_NoProfileTag__AddsRepoToModel()
        {
            _settings = ReadTestSettings("test-settings.xml");

            Profile profile = SettingsUtil.GetDefaultProfile(_settings, true);

            Assert.IsNotNull(profile);
            SettingsUtil.AddRepositoryToProfile(profile, _repoUrl1, true, false);

            Assert.AreEqual(1, _settings.profiles.Length, "Settings does not contain a profile");

            Repository repository = SettingsUtil.GetRepositoryFromProfile(profile, _repoUrl1);

            Assert.IsNotNull(repository, "Repository '" + _repoUrl1 + "' was not added to profile");

            Assert.AreEqual("npanday.repo.0", repository.id);
            Assert.AreEqual(_repoUrl1, repository.url);
        }
Пример #2
0
        private NPanday.Model.Settings.Repository getRepository(string url)
        {
            if (string.IsNullOrEmpty(url))
            {
                return(null);
            }

            // extract from NPanday repositories first
            NPanday.Model.Settings.Repository repo;
            NPanday.Model.Settings.Profile    defaultProfile = getDefaultProfile();
            if (defaultProfile != null)
            {
                repo = SettingsUtil.GetRepositoryFromProfile(defaultProfile, url);
                if (repo != null)
                {
                    return(repo);
                }
            }

            // extract from NON-NPanday repositories
            return(SettingsUtil.GetRepositoryByUrl(settings, url));
        }
Пример #3
0
        public void AddRepository_WithProfileTag_AddsRepoToModel()
        {
            _settings = ReadTestSettings("test-settings-with-profile.xml");

            Profile profile = SettingsUtil.GetDefaultProfile(_settings, false);

            Assert.IsNotNull(profile);

            SettingsUtil.SetProfileRepository(profile, _repoUrl2, true, false);

            Assert.AreEqual(1, _settings.profiles.Length, "Settings does not contain a profile");
            Assert.AreEqual(1, _settings.profiles[0].repositories.Length);

            Repository repository = SettingsUtil.GetRepositoryFromProfile(profile, _repoUrl1);

            Assert.IsNull(repository, "Repository '" + _repoUrl1 + "' was in the profile");

            repository = SettingsUtil.GetRepositoryFromProfile(profile, _repoUrl2);
            Assert.IsNotNull(repository, "Repository '" + _repoUrl2 + "' was not added to profile");
            Assert.AreEqual("npanday.repo", repository.id);
            Assert.AreEqual(_repoUrl2, repository.url);
        }