public async void RunMainTask_Failed() { _pluginManager.Setup(p => p.InvokeTaskProvider(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync((string pluginDll, string pluginArgs, string secretPluginArgs) => new Dictionary <string, object> { { "errorMessage", "error-message" } }); var config = new Dictionary <string, string>(); var task = new CloneTask(_projectService.Object, _externalServiceService.Object, _externalServiceTypeService.Object, _providerService.Object, _pluginManager.Object, _logger.Object); task.SetConfig(config, "working"); task.Provider = "FakeCodeRepositoryProvider"; var result = await task.RunMainTask(new Dictionary <string, string>()); Assert.False(result.IsSuccess); Assert.Equal("error-message", result.ErrorMessage); }
public async void RunMainTask_Success() { _pluginManager.Setup(p => p.InvokeTaskProvider(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync((string pluginDll, string pluginArgs, string secretPluginArgs) => new Dictionary <string, object> { { "cloneLocation", "c:\\test" } }); var config = new Dictionary <string, string>(); var task = new CloneTask(_projectService.Object, _externalServiceService.Object, _externalServiceTypeService.Object, _providerService.Object, _pluginManager.Object, _logger.Object); task.SetConfig(config, "working"); task.Provider = "FakeCodeRepositoryProvider"; var result = await task.RunMainTask(new Dictionary <string, string>()); Assert.True(result.IsSuccess); Assert.Equal("c:\\test", result.ReturnValue); Assert.Equal("The repository has been cloned to c:\\test", result.TaskRemarks); }