public void Delete_and_clone_when_repo_is_not_valid( [Frozen] IRepositoryStaticWrapper wrapper, [Frozen] IFileUtilities fileUtils, GitRepositoryFactory sut) { wrapper.IsValid(Arg.Any <string>()).Returns(false); sut.CreateAndCloneIfNeeded("repo_url", "repo_path", "branch"); Received.InOrder(() => { wrapper.IsValid("repo_path"); fileUtils.DeleteReadOnlyDirectory("repo_path"); wrapper.Clone("repo_url", "repo_path", Verify.That <CloneOptions>(x => x.BranchName.Should().Be("branch"))); }); }
private void DeleteAndCloneRepo(string repoUrl, string repoPath, string branch) { _fileUtils.DeleteReadOnlyDirectory(repoPath); var progress = new ProgressBar { Description = "Fetching guide data" }; _staticWrapper.Clone(repoUrl, repoPath, new CloneOptions { RecurseSubmodules = false, BranchName = branch, OnTransferProgress = gitProgress => { progress.ReportProgress.OnNext((float)gitProgress.ReceivedObjects / gitProgress.TotalObjects); return(true); } }); }