public void Init()
 {
     sharpBucket = TestHelpers.GetV2ClientAuthenticatedWithBasicAuthentication();
      var repositoriesEndPoint = sharpBucket.RepositoriesEndPoint();
      repositoryResource = repositoriesEndPoint.RepositoryResource(ACCOUNT_NAME, REPOSITORY_NAME);
 }
예제 #2
0
        private static void TestRestRepositoriesEndPoint(SharpBucketV2 sharpBucket)
        {
            var repositoriesEndPoint = sharpBucket.RepositoriesEndPoint();
            var repositories = repositoriesEndPoint.ListRepositories(accountName);
            var publicRepositories = repositoriesEndPoint.ListPublicRepositories();
            var repositoryResource = repositoriesEndPoint.RepositoryResource(accountName, repository);
            //var repoInfo = new RepositoryInfo();
            //var newRepository = repositoriesEndPoint.PutRepository(repo, accountName, repository);
            //var deletedRepository = repositoriesEndPoint.DeleteRepository(newRepository, accountName, repository);
            var watchers = repositoryResource.ListWatchers();
            var forks = repositoryResource.ListForks();
            var branchRestictions = repositoryResource.ListBranchRestrictions();
            var newRestrictions = repositoryResource.PostBranchRestriction(new BranchRestriction());
            int restrictionId = 1;
            var restriction = repositoryResource.GetBranchRestriction(restrictionId);
            var newRestiction = repositoryResource.PutBranchRestriction(new BranchRestriction());
            var deletedRestiction = repositoryResource.DeleteBranchRestriction(restrictionId);
            var diff = repositoryResource.GetDiff(null);
            var patch = repositoryResource.GetPatch(null);
            var commits = repositoryResource.ListCommits();
            string commitId = "sdfsdf";
            var commit = repositoryResource.GetCommit(commitId);
            var commitComments = repositoryResource.ListCommitComments(commitId);
            int commentId = 10;
            var commitComment = repositoryResource.GetCommitComment(commitId, commentId);
            var commitApproval = repositoryResource.ApproveCommit(commitId);
            var deleteApproval = repositoryResource.DeleteCommitApproval(commitId);

            var r = repositoriesEndPoint.RepositoryResource(accountName, repository);
            var dr = r.DeleteRepository();
            var w = r.ListWatchers();
            var f = r.ListForks();
            var br = r.ListBranchRestrictions();
            var gr = r.GetBranchRestriction(restrictionId);
            var nr = r.PostBranchRestriction(new BranchRestriction());
            var dbr = r.DeleteBranchRestriction(restrictionId);
            var diff2 = r.GetDiff(new object());
            var patch2 = r.GetPatch(new object());
            var commits2 = r.ListCommits();
            var commit2 = r.GetCommit(commitId);
            var commitComments2 = r.ListCommitComments(commitId);
            var commitComment2 = r.GetCommitComment(commitId, commentId);
            var commitApproval2 = r.ApproveCommit(commitId);
            var deleteApproval2 = r.DeleteCommitApproval(commitId);

            var pullRequestsResource = r.PullRequestsResource();
            var pullRequests = pullRequestsResource.ListPullRequests();
            var source = new Source{
                branch = new Branch{name = "develop"},
                repository = new Repository{
                    full_name = repository
                }
            };
            var destination = new Source{
                branch = new Branch{name = "master"},
                commit = new Commit{hash = "56c3aca"}
            };
            var newRequest = new PullRequest{
                title = "testing new one",
                description = "My new description",
                source = source,
                destination = destination
            };
            //var newPullRequest = repositoriesEndPoint.PostPullRequest(accountName, repository, newRequest);
            //var updatedPullRequest = repositoriesEndPoint.PutPullRequest(accountName, repository, new PullRequest());
            //var pullRequestId = 1;
            //var pullRequest = repositoriesEndPoint.GetPullRequest(accountName, repository, pullRequestId);
            //pullRequest.title = "HEHEHEH";
            //var updatedPullRequest = repositoriesEndPoint.PutPullRequest(accountName, repository, pullRequest);

            //var commitsInPullRequest = repositoriesEndPoint.ListPullRequestCommits(accountName, repository, pullRequestId);
            //var postPullRequestApproval = repositoriesEndPoint.ApprovePullRequest(accountName, repository, pullRequestId);
            //var deletePullRequest = repositoriesEndPoint.RemovePullRequestApproval(accountName, repository, pullRequestId);
            //var getDiffForPullRequest = repositoriesEndPoint.GetDiffForPullRequest(accountName, repository, pullRequestId);
            //var pullRequestLog = repositoriesEndPoint.GetPullRequestLog(accountName, repository);
            //var pullRequestActivity = repositoriesEndPoint.GetPullRequestActivity(accountName, repository, pullRequestId);
            //var acceptPullRequest = repositoriesEndPoint.AcceptAndMergePullRequest(accountName, repository, pullRequestId);
            //var declinePullRequest = repositoriesEndPoint.DeclinePullRequest(accountName, repository, pullRequestId);
            //var pullRequestComments = repositoriesEndPoint.ListPullRequestComments(accountName, repository, pullRequestId);
            //var commentId = 10;
            //var pullRequestComment = repositoriesEndPoint.GetPullRequestComment(accountName, repository, pullRequestId, commentId);

            //var pullRequestsEP = repositoriesEndPoint.PullReqestsResource(accountName, repository);
            //var PRs = pullRequestsEP.ListPullRequests();
            //var newPR = pullRequestsEP.PostPullRequest(new PullRequest());
            //var updatedPR = pullRequestsEP.PutPullRequest(new PullRequest());
            //var PRId = 10;
            //var PR = pullRequestsEP.GetPullRequest(PRId);
            //var commitsInPR = pullRequestsEP.ListPullRequestCommits(PRId);
            //var postPRApproval = pullRequestsEP.ApprovePullRequest(PRId);
            //var deletePR = pullRequestsEP.RemovePullRequestApproval(PRId);
            //var getDiffForPR = pullRequestsEP.GetDiffForPullRequest(PRId);
            //var PRLog = pullRequestsEP.GetPullRequestLog();
            //var PRActivity = pullRequestsEP.GetPullRequestActivity(PRId);
            //var acceptPR = pullRequestsEP.AcceptAndMergePullRequest(PRId);
            //var declinePR = pullRequestsEP.DeclinePullRequest(PRId);
            //var PRComments = pullRequestsEP.ListPullRequestComments(PRId);
            //var cId = 10;
            //var PRComment = pullRequestsEP.GetPullRequestComment(PRId, cId);

            //var PRId2 = 10;
            //var pullRequestEP = pullRequestsEP.PullRequestEndPoint(PRId);
            //var PR2 = pullRequestEP.GetPullRequest();
            //var commitsInPR2 = pullRequestEP.ListPullRequestCommits();
            //var postPR2Approval = pullRequestEP.ApprovePullRequest();
            //var deletePR2 = pullRequestEP.RemovePullRequestApproval();
            //var getDiffForPR2 = pullRequestEP.GetDiffForPullRequest();
            //var PR2Activity = pullRequestEP.GetPullRequestActivity();
            //var acceptPR2 = pullRequestEP.AcceptAndMergePullRequest();
            //var declinePR2 = pullRequestEP.DeclinePullRequest();
            //var PR2Comments = pullRequestEP.ListPullRequestComments();
            //var cId2 = 10;
            //var PR2Comment = pullRequestEP.GetPullRequestComment(cId2);
        }
 public void Init()
 {
     sharpBucket = TestHelpers.GetV2ClientAuthenticatedWithBasicAuthentication();
      repositoriesEndPoint = sharpBucket.RepositoriesEndPoint();
 }