Пример #1
0
        private async void ShowChanges()
        {
            if (!this.ValidateAutoCompleteBoxes())
            {
                return;
            }
            if (!this.ValidateTextBoxes())
            {
                return;
            }

            try
            {
                await _viewModel.RetrieveDiffs();
            }
            catch (NotFoundException)
            {
                MessageBoxHelper.ShowError(this,
                                           "Unable to find the pull request.\r\nEither the information you provided is incorrect or you don't have permission to view the pull request.");
            }

            catch (Exception ex)
            {
                MessageBoxHelper.ShowError(this, "Unable to get changes.\r\n" + ex);
            }
        }
Пример #2
0
        public async void ShouldBeAbleToGetDiffsForPullRequest()
        {
            await _mainWindowVm.RetrieveDiffs();

            _prClient.Received(1)
            .Get(_mainWindowVm.PullRequestLocator.Owner, _mainWindowVm.PullRequestLocator.Repository,
                 _mainWindowVm.PullRequestLocator.PullRequestNumber).IgnoreAsyncWarning();
            _commitsClient.Received(1)
            .Compare(_mainWindowVm.PullRequestLocator.Owner, _mainWindowVm.PullRequestLocator.Repository,
                     _pullRequest.Base.Sha, _pullRequest.Head.Sha).IgnoreAsyncWarning();
            var githubCommitFiles = _mainWindowVm.Diffs.Select(r => r.GitHubCommitFile);

            Assert.That(githubCommitFiles, Contains.Item(_compareResults.File1));
            Assert.That(githubCommitFiles, Contains.Item(_compareResults.File2));
        }