public async Task GetBranchesAndEnvironments() { if (!string.IsNullOrEmpty(_octopusUrl) && !string.IsNullOrEmpty(_octopusApiKey)) { IsLoadingData = true; try { await Task.Factory.StartNew(() => { var deploymentPlanner = new OctopusDeploymentPlanner(_octopusUrl, _octopusApiKey); Branches = deploymentPlanner.GetBranches(); Environments = deploymentPlanner.GetEnvironments(); }); } catch (Exception x) { MessageBox.Show(x.Message, x.GetType().Name, MessageBoxButton.OK, MessageBoxImage.Error); } IsLoadingData = false; } else { Branches = new List <Branch>(); Environments = new List <Environment>(); } }
public void GetBranches() { var octopusUrl = ConfigurationManager.AppSettings["OctopusUrl"]; var octopusApiKey = ConfigurationManager.AppSettings["OctopusApiKey"]; var deploymentPlanner = new OctopusDeploymentPlanner(octopusUrl, octopusApiKey); var branches = deploymentPlanner.GetBranches(); branches.Count.Should().BeGreaterThan(0); }