public async Task <ConfigurationState <RunnerRepoInfo> > Checkout( CheckoutInput checkoutInput, CancellationToken cancel) { try { cancel.ThrowIfCancellationRequested(); _logger.Information("Targeting {PatcherVersioning}", checkoutInput.PatcherVersioning); using var repoCheckout = RepoCheckouts.Get(RunnerRepoDirectoryProvider.Path); var target = ResetToTarget.Reset(repoCheckout.Repository, checkoutInput.PatcherVersioning, cancel); if (target.Failed) { return(target.BubbleFailure <RunnerRepoInfo>()); } cancel.ThrowIfCancellationRequested(); checkoutInput.LibraryNugets.Log(_logger); var slnPath = SolutionFileLocator.GetPath(RunnerRepoDirectoryProvider.Path); if (slnPath == null) { return(GetResponse <RunnerRepoInfo> .Fail("Could not locate solution to run.")); } var foundProjSubPath = RunnerRepoProjectPathRetriever.Get(slnPath.Value, checkoutInput.Proj); if (foundProjSubPath == null) { return(GetResponse <RunnerRepoInfo> .Fail($"Could not locate target project file: {checkoutInput.Proj}.")); } cancel.ThrowIfCancellationRequested(); ModifyRunnerProjects.Modify( slnPath.Value, drivingProjSubPath: foundProjSubPath.SubPath, versions: checkoutInput.LibraryNugets.ReturnIfMatch(new NugetVersionPair(null, null)), listedVersions: out var listedVersions); var runInfo = new RunnerRepoInfo( SolutionPath: slnPath, ProjPath: foundProjSubPath.FullPath, MetaPath: _metaFilePathProvider.Path, Target: target.Value.Target, CommitMessage: target.Value.CommitMessage, CommitDate: target.Value.CommitDate, ListedVersions: listedVersions, TargetVersions: checkoutInput.LibraryNugets.ReturnIfMatch(listedVersions)); return(GetResponse <RunnerRepoInfo> .Succeed(runInfo)); } catch (OperationCanceledException) { throw; } catch (Exception ex) { return(GetResponse <RunnerRepoInfo> .Fail(ex)); } }
public void NoResultReturnsNull( FilePath solutionPath, FilePath projPath, RunnerRepoProjectPathRetriever sut) { sut.AvailableProjectsRetriever.Get(default).ReturnsForAnyArgs(Enumerable.Empty <string>());