コード例 #1
0
        public ObservableIssueCommentsClient(IGitHubClient client)
        {
            Ensure.ArgumentNotNull(client, "client");

            _client = client.Issue.Comment;
            _connection = client.Connection;
        }
コード例 #2
0
        public ObservableIssueCommentsClient(IGitHubClient client)
        {
            Ensure.ArgumentNotNull(client, nameof(client));

            _client     = client.Issue.Comment;
            _connection = client.Connection;
        }
コード例 #3
0
        public TheDeleteMethod()
        {
            var gitHubClient = Helper.GetAuthenticatedClient();

            var repoName = Helper.MakeNameWithTimestamp("public-repo");

            _context = gitHubClient.CreateRepositoryContext(new NewRepository(repoName)).Result;

            _issuesClient        = gitHubClient.Issue;
            _issueCommentsClient = gitHubClient.Issue.Comment;
        }
コード例 #4
0
 public MainWindowVm(IGitHubClient client, IFileContentPersist fileContentPersist,
                     IDiffToolLauncher diffTool,
                     IPatchService patchService,
                     ICommentsBuilder commentsBuilder,
                     ICommentsPersist commentsPersist,
                     IRepoHistoryPersist repoHistoryPersist,
                     IBackgroundTaskRunner backgroundTaskRunner, IUserManager userManager)
 {
     Diffs                 = new ObservableCollection <CommitFileVm>();
     Commits               = new ObservableCollection <CommitVm>();
     _client               = client;
     PersonalToken         = userManager.CurrentUser.Token;
     _fileContentPersist   = fileContentPersist;
     _diffTool             = diffTool;
     _patchService         = patchService;
     _reviewClient         = client.Issue.Comment;
     _commentsBuilder      = commentsBuilder;
     _commentsPersist      = commentsPersist;
     _repoHistoryPersist   = repoHistoryPersist;
     _backgroundTaskRunner = backgroundTaskRunner;
 }
コード例 #5
0
        public TheGetAllForRepositoryMethod()
        {
            _github = Helper.GetAuthenticatedClient();

            _issueCommentsClient = _github.Issue.Comment;
        }
コード例 #6
0
        public TheGetAllForRepositoryMethod()
        {
            _github = Helper.GetAuthenticatedClient();

            _issueCommentsClient = _github.Issue.Comment;
        }
コード例 #7
0
        public TheDeleteMethod()
        {
            var gitHubClient = Helper.GetAuthenticatedClient();

            var repoName = Helper.MakeNameWithTimestamp("public-repo");

            _context = gitHubClient.CreateRepositoryContext(new NewRepository(repoName)).Result;

            _issuesClient = gitHubClient.Issue;
            _issueCommentsClient = gitHubClient.Issue.Comment;
        }
コード例 #8
0
 public IssueCommentsClientTests()
 {
     var github = Helper.GetAuthenticatedClient();
     _issueCommentsClient = github.Issue.Comment;
 }
コード例 #9
0
        public void SetUp()
        {
            _compareResults       = new MockCompareResult();
            _gitHubClient         = Substitute.For <IGitHubClient>();
            _repoClient           = Substitute.For <IRepositoriesClient>();
            _commitsClient        = Substitute.For <IRepositoryCommitsClient>();
            _prClient             = Substitute.For <IPullRequestsClient>();
            _contentsClient       = Substitute.For <IRepositoryContentsClient>();
            _fileContentPersist   = Substitute.For <IFileContentPersist>();
            _diffTool             = Substitute.For <IDiffToolLauncher>();
            _patchService         = Substitute.For <IPatchService>();
            _reviewClient         = Substitute.For <IIssueCommentsClient>();
            _commentsBuilder      = Substitute.For <ICommentsBuilder>();
            _commentsPersist      = Substitute.For <ICommentsPersist>();
            _repoHistoryPersist   = Substitute.For <IRepoHistoryPersist>();
            _backgroundTaskRunner = Substitute.For <IBackgroundTaskRunner>();
            var userManager = Substitute.For <IUserManager>();

            _gitHubClient.Repository.Returns(_repoClient);
            _repoClient.Commit.Returns(_commitsClient);
            _repoClient.PullRequest.Returns(_prClient);
            _repoClient.Content.Returns(_contentsClient);
            _gitHubClient.Issue.Comment.Returns(_reviewClient);

            _commitsClient.Compare(Arg.Any <string>(),
                                   Arg.Any <string>(),
                                   Arg.Any <string>(),
                                   Arg.Any <string>()
                                   ).Returns(Task.FromResult((CompareResult)_compareResults));

            _mainWindowVm = new MainWindowVm(_gitHubClient, _fileContentPersist,
                                             _diffTool, _patchService, _commentsBuilder,
                                             _commentsPersist, _repoHistoryPersist, _backgroundTaskRunner, userManager)
            {
                PullRequestLocator = _pullRequestLocator,
                IsUrlMode          = false
            };

            _pullRequest = new MockPullRequest {
                Number = _pullRequestLocator.PullRequestNumber
            };
            _prClient.Get(_mainWindowVm.PullRequestLocator.Owner, _mainWindowVm.PullRequestLocator.Repository,
                          _mainWindowVm.PullRequestLocator.PullRequestNumber).Returns(Task.FromResult((PullRequest)_pullRequest));

            _baseFileName = MainWindowVm.BuildBaseFileName(_pullRequest.Base.Sha, _compareResults.File1.Filename);
            _headFileName = MainWindowVm.BuildHeadFileName(_pullRequest.Head.Sha, _compareResults.File1.Filename);

            _commentsContainer = new CommentsContainer {
                GeneralComments = GeneralComments
            };
            _commentsContainer.FileComments.Add(new FileComment
            {
                FileName     = _compareResults.File1.Filename,
                Comments     = Comment1,
                ReviewStatus = ReviewStatus1
            });
            _commentsContainer.FileComments.Add(new FileComment
            {
                FileName     = _compareResults.File2.Filename,
                Comments     = Comment2,
                ReviewStatus = ReviewStatus2
            });
            _commentsPersist.Load(Arg.Is <PullRequestLocator>(x => x.Equals(_pullRequestLocator)))
            .Returns(Task.FromResult(_commentsContainer));

            _backgroundTaskRunner.WhenForAnyArgs(x => x.RunInBackground(null)).Do(args =>
            {
                var a = args[0] as Action;
                a.Invoke();
            });

            _commentsPersist.ClearReceivedCalls();
            _backgroundTaskRunner.ClearReceivedCalls();
        }
コード例 #10
0
    public IssueCommentsClientTests()
    {
        var github = Helper.GetAuthenticatedClient();

        _issueCommentsClient = github.Issue.Comment;
    }