private async Task OpenInDiffTool(object sender) { if (_viewModel.SelectedDiffFile == null) { return; } if (_viewModel.SelectedDiffFile.GitHubCommitFile.Status == GitFileStatus.Renamed && _viewModel.SelectedDiffFile.IsTheSameAsOrgFile()) { var ballon = new Balloon(sender as Control, "No changes found. It's just renamed", BalloonType.Information, placeInCenter: true, showCloseButton: true); ballon.Show(); _viewModel.SelectedDiffFile.ReviewStatus = ReviewStatus.Reviewed; return; } try { await _viewModel.PrepareDiffContent(); } catch (InvalidDiffToolSettings) { MessageBoxHelper.ShowError(this, "Unable to launch the diff tool.\r\nPlease check your settings."); ShowSettingsCmd.Execute(null); } catch (FailedToSaveContent ex) { MessageBoxHelper.ShowError(this, "Unable to save content. Please try again later.\r\n\r\n" + ex); } catch (Exception ex) { MessageBoxHelper.ShowError(this, "Unable to get diff content.\r\n\r\n" + ex); } }
public async void CanRetieveFileContent() { MockFile1PersistFor("baseContent", _pullRequest.Base.Sha); MockFile1PersistFor("headContent", _pullRequest.Head.Sha); _mainWindowVm.SelectedDiffFile = new CommitFileVm(_compareResults.File1); await _mainWindowVm.RetrieveDiffs(); await _mainWindowVm.PrepareDiffContent(); var basePath = _compareResults.File1.GetFilePath(_pullRequest.Base.Sha); var headPath = _compareResults.File1.GetFilePath(_pullRequest.Head.Sha); _contentsClient.Received(1).GetAllContents(_pullRequestLocator.Owner, _pullRequestLocator.Repository, basePath).IgnoreAsyncWarning(); _contentsClient.Received(1).GetAllContents(_pullRequestLocator.Owner, _pullRequestLocator.Repository, headPath).IgnoreAsyncWarning(); }