示例#1
0
 private static void TestRepositoriesEndPoint(SharpBucketV1 sharpBucket)
 {
     var repositoriesEndPoint = sharpBucket.RepositoriesEndPoint(accountName, repository);
     var tags = repositoriesEndPoint.ListTags();
     var branches = repositoriesEndPoint.ListBranches();
     var mainBranch = repositoriesEndPoint.GetMainBranch();
     string WIKI_PAGE = "";
     var wiki = repositoriesEndPoint.GetWiki(WIKI_PAGE);
     var newPage = new Wiki{data = "Hello to my new page"};
     var newWiki = repositoriesEndPoint.PostWiki(newPage, "NewPage");
     var changeSet = repositoriesEndPoint.ListChangeset();
     var change = changeSet.changesets[4];
     var getChange = repositoriesEndPoint.GetChangeset(change.node);
     var diffStats = repositoriesEndPoint.GetChangesetDiffstat(change.node);
     var repoEvents = repositoriesEndPoint.ListEvents();
     var links = repositoriesEndPoint.ListLinks();
     var newLink = new Link{id = 100};
     var newLinkResponse = repositoriesEndPoint.PostLink(newLink);
     var link = repositoriesEndPoint.GetLink(newLinkResponse.id);
     newLinkResponse.handler.name = "sfsdf";
     var updatedLink = repositoriesEndPoint.PutLink(newLinkResponse);
     repositoriesEndPoint.DeleteLink(updatedLink);
 }
示例#2
0
        private static void TestIssuesEndPoint(SharpBucketV1 sharpBucket)
        {
            var issuesResource = sharpBucket.RepositoriesEndPoint(accountName, repository).IssuesResource();

            int ISSUE_ID = 5;
            // Issues
            var issues = issuesResource.ListIssues();
            var newIssue = new Issue{title = "Let's add a new issue", content = "Some issue content", status = "new", priority = "trivial", kind = "bug"};
            var newIssueResult = issuesResource.PostIssue(newIssue);
            var issue = issuesResource.GetIssue(newIssueResult.local_id);
            var changedIssue = new Issue{title = "Completely new title", content = "Hi!", status = "new", local_id = issue.local_id};
            var changedIssueResult = issuesResource.PutIssue(changedIssue);
            issuesResource.DeleteIssue(changedIssueResult.local_id);

            // Issue comments
            var issueResource = issuesResource.IssueResource(ISSUE_ID);
            var issueComments = issueResource.ListComments();
            var newComment = new Comment{content = "This bug is really annoying!"};
            var newCommentResult = issueResource.PostComment(newComment);
            var comment = issueResource.GetIssueComment(newCommentResult.comment_id);
            comment.content = "The bug is still annoying";
            var updatedCommentRes = issueResource.PutIssueComment(comment);
            issueResource.DeleteIssueComment(updatedCommentRes.comment_id);

            // Issue followers
            var issueFollowers = issueResource.ListFollowers();

            // Components
            var components = issuesResource.ListComponents();
            var newComponent = new Component{name = "Awesome component"};
            var newComponentRes = issuesResource.PostComponent(newComponent);
            var component = issuesResource.GetComponent(newComponentRes.id);
            component.name = "Even more awesome component";
            var updatedComponent = issuesResource.PutComponent(component);
            issuesResource.DeleteComponent(updatedComponent.id);

            // Milestones
            var milestones = issuesResource.ListMilestones();
            var newMilestone = new Milestone{name = "Awesome milestone"};
            var newMilestoneRes = issuesResource.PostMilestone(newMilestone);
            var milestone = issuesResource.GetMilestone(newMilestoneRes.id);
            milestone.name = "Even more awesome milestone";
            var updatedMilestone = issuesResource.PutMilestone(milestone);
            issuesResource.DeleteMilestone(updatedMilestone.id);

            // Versions
            var versions = issuesResource.ListVersions();
            var newVersion = new Version{name = "Awesome version"};
            var newVersionRes = issuesResource.PostVersion(newVersion);
            var version = issuesResource.GetVersion(newVersionRes.id);
            version.name = "Even more awesome version";
            var updatedversion = issuesResource.PutVersion(version);
            issuesResource.DeleteVersion(updatedversion.id);
        }