public async void Pull_Success() { var repositoryFolder = Path.Combine(AppContext.BaseDirectory, "repo"); if (Directory.Exists(repositoryFolder)) { Directory.Delete(repositoryFolder); } _gitHubUtils.Setup(u => u.CloneIfNotExistLocally(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>())) .Callback(() => Directory.CreateDirectory(repositoryFolder)) .ReturnsAsync(repositoryFolder); var taskConfig = new PullTaskConfig { RepositoryLocation = repositoryFolder, Repository = "https://github.com/polyrific-inc/opencatapult" }; var additionalConfigs = new Dictionary <string, string>(); var provider = new Program(new string[] { GetPullArgString("main", "TestProject", taskConfig, additionalConfigs) }, _gitHubUtils.Object); var result = await provider.Pull(); Assert.Equal(repositoryFolder, result.repositoryLocation); Assert.Equal("", result.errorMessage); Assert.True(Directory.Exists(repositoryFolder)); }
private string GetPullArgString(string process, string projectName, PullTaskConfig taskConfig, Dictionary <string, string> additionalConfigs) { var dict = new Dictionary <string, object> { { "process", process }, { "project", projectName }, { "pullconfig", taskConfig }, { "additional", additionalConfigs } }; return(JsonConvert.SerializeObject(dict)); }