public void RepositorySettings_GetsCorrectSettings() { var settings = _azureSettingsReader.RepositorySettings(new Uri("https://org.visualstudio.com/project/_git/reponame")); Assert.IsNotNull(settings); Assert.AreEqual("https://org.visualstudio.com/", settings.ApiUri.ToString()); Assert.AreEqual("https://org.visualstudio.com/project/_git/reponame/", settings.RepositoryUri.ToString()); Assert.AreEqual(settings.RepositoryName, "reponame"); Assert.AreEqual(settings.RepositoryOwner, "project"); }
public void RepositorySettings_GetsCorrectSettings() { var settings = _azureSettingsReader.RepositorySettings(new Uri("https://internalserver/tfs/project/_git/reponame")); Assert.IsNotNull(settings); Assert.AreEqual("https://internalserver/tfs", settings.ApiUri.ToString()); Assert.AreEqual("https://*****:*****@internalserver/tfs/project/_git/reponame/", settings.RepositoryUri.ToString()); Assert.AreEqual(settings.RepositoryName, "reponame"); Assert.AreEqual(settings.RepositoryOwner, "project"); }
public void RepositorySettings_GetsCorrectSettings() { var settings = _azureSettingsReader.RepositorySettings(new Uri("https://dev.azure.com/org/project/_git/reponame")); Assert.IsNotNull(settings); Assert.AreEqual(settings.ApiUri, "https://dev.azure.com/org/"); Assert.AreEqual(settings.RepositoryUri, "https://dev.azure.com/org/project/_git/reponame"); Assert.AreEqual(settings.RepositoryName, "reponame"); Assert.AreEqual(settings.RepositoryOwner, "project"); }
public async Task RepositorySettings_GetsCorrectSettingsOrganisation() { var settings = await _azureSettingsReader.RepositorySettings(new Uri("https://dev.azure.com/org/project/_git/reponame"), true); Assert.IsNotNull(settings); Assert.AreEqual(settings.ApiUri, "https://dev.azure.com/org/"); Assert.AreEqual(settings.RepositoryUri, "https://dev.azure.com/org/project/_git/reponame"); Assert.AreEqual(settings.RepositoryName, "reponame"); Assert.AreEqual(settings.RepositoryOwner, "project"); Assert.AreEqual(settings.SetAutoMerge, true); }
protected override async Task <ValidationResult> PopulateSettings(SettingsContainer settings) { if (string.IsNullOrWhiteSpace(RepositoryUri)) { return(ValidationResult.Failure($"Missing repository URI")); } Uri repoUri; try { repoUri = RepositoryUri.ToUri(); } catch (UriFormatException) { return(ValidationResult.Failure($"Bad repository URI: '{RepositoryUri}'")); } ISettingsReader reader = await TryGetSettingsReader(repoUri, Platform); if (reader == null) { return(ValidationResult.Failure($"Unable to work out which platform to use {RepositoryUri} could not be matched")); } settings.SourceControlServerSettings.Repository = await reader.RepositorySettings(repoUri, SetAutoMerge ?? false, TargetBranch, MergeStrategy ?? GitPullRequestMergeStrategy.NoFastForward); var baseResult = await base.PopulateSettings(settings); if (!baseResult.IsSuccess) { return(baseResult); } if (settings.SourceControlServerSettings.Repository == null) { return(ValidationResult.Failure($"Could not read repository URI: '{RepositoryUri}'")); } settings.SourceControlServerSettings.Scope = ServerScope.Repository; settings.UserSettings.MaxRepositoriesChanged = 1; settings.UserSettings.Directory = CheckoutDirectory; return(ValidationResult.Success); }