public async void ReturnsAllIssuesForOwnedAndMemberRepositories() { var newIssue = new NewIssue("Integration test issue"); var createResult = await client.Create(createdRepository.Owner.Name, repoName, newIssue); var result = client.GetAllForOwnedAndMemberRepositories().ToList().Wait(); Assert.NotEmpty(result); }
public async void ReturnsAllIssuesForCurrentUser() { var newIssue = new NewIssue("Integration test issue"); var createResult = await client.Create(createdRepository.Owner.Name, repoName, newIssue); var issues = client.GetAllForCurrent().ToList().Wait(); Assert.NotEmpty(issues); }
public async void CanCreateAndUpdateIssues() { var newIssue = new NewIssue("Integration test issue"); var createResult = await client.Create(createdRepository.Owner.Name, repoName, newIssue); var updateResult = await client.Update(createdRepository.Owner.Name, repoName, createResult.Number, new IssueUpdate { Title = "Modified integration test issue" }); Assert.Equal("Modified integration test issue", updateResult.Title); }
public async Task CanDeserializeCrossReferenceEvent() { var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); newIssue = new NewIssue("another test issue") { Body = "Another new unassigned issue referencing the first new issue in #" + issue.Number }; var anotherNewIssue = await _issuesClient.Create(_context.Repository.Id, newIssue); var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); Assert.Equal(1, timelineEventInfos.Count); Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Id); }
public async Task CanDeserializeRenameEvent() { var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); var renamed = await _issuesClient.Update(_context.Repository.Id, issue.Number, new IssueUpdate { Title = "A test issue" }); Assert.NotNull(renamed); Assert.Equal("A test issue", renamed.Title); var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); Assert.Equal(1, timelineEventInfos.Count); Assert.Equal("a test issue", timelineEventInfos[0].Rename.From); Assert.Equal("A test issue", timelineEventInfos[0].Rename.To); }
public async Task ReturnsDistinctIssueLabelsBasedOnStartPageForAMilestone() { var newMilestone = new NewMilestone("New Milestone"); var milestone = await _issuesClient.Milestone.Create(_context.RepositoryOwner, _context.RepositoryName, newMilestone); for (int i = 0; i < 2; i++) { int k = i + 1; var newIssue = new NewIssue("A test issue " + k) { Body = "A new unassigned issue " + k }; var newLabel = new NewLabel("test label " + k, "FFFFF" + k); var label = await _issuesLabelsClient.Create(_context.RepositoryOwner, _context.RepositoryName, newLabel); var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); var issueUpdate = new IssueUpdate { Milestone = milestone.Number }; issueUpdate.AddLabel(label.Name); var updated = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate); Assert.NotNull(updated); } var startOptions = new ApiOptions { PageCount = 1, PageSize = 1, StartPage = 1 }; var firstPage = await _issuesLabelsClient.GetAllForMilestone(_context.RepositoryOwner, _context.RepositoryName, milestone.Number, startOptions); var skipStartOptions = new ApiOptions { PageSize = 1, PageCount = 1, StartPage = 2 }; var secondPage = await _issuesLabelsClient.GetAllForMilestone(_context.RepositoryOwner, _context.RepositoryName, milestone.Number, skipStartOptions); Assert.Equal(1, firstPage.Count); Assert.Equal(1, secondPage.Count); Assert.NotEqual(firstPage.First().Color, secondPage.First().Color); }
public async Task CanRetrieveTimelineForIssue() { var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); Assert.Empty(timelineEventInfos); var closed = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate() { State = ItemState.Closed }); Assert.NotNull(closed); timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); Assert.Equal(1, timelineEventInfos.Count); Assert.Equal(EventInfoState.Closed, timelineEventInfos[0].Event); }
public static async void SendIssue(Exception ex, string body) { var client = new GitHubClient(new ProductHeaderValue("ttap-bug-report")); string encryptedToken = "WeLRINbTL+o7ae7LJyJguK6MNKeqCwfC6GEYreE4GJhCV0A0spfaRxoBjgQWgCeOdaaNSIp2f2dHBMEuMOUDAN0lxZOWyzP1T2dd5JQRcgUlk2Yjzz7uKbf1w31XCpj9QT7F6iNqhqW44TNigHTb5Pb1t2DAiUiz2MxozJtgsEE="; var basicAuth = new Credentials(StringCipher.Decrypt(encryptedToken, "TTAP")); // NOTE: not real credentials client.Credentials = basicAuth; var createIssue = new NewIssue("Bug report #" + DateTime.Now.GetHashCode()); createIssue.Body = ex.Message + "\n====================\n"; createIssue.Body += ex.StackTrace + "\n====================\n"; createIssue.Body += body; var issue = await client.Issue.Create("wongjiahau", "TTAP-Bug-Report", createIssue); }
public Task <Issue> OpenGeneralIssue(System.Exception err) { NewIssue createIssue = new NewIssue(err.Message); createIssue.Body = $"## Source: {err.Source} \n" + $"```csharp\n" + $"{err.StackTrace}\n" + $"```"; createIssue.Labels.Add("error"); var issue = _client.Issue.Create("irsooti", "steam-bot", createIssue); return(issue); }
private static async Task CreateErrorsIssue(IEnumerable <Regression> regressions) { if (regressions == null || !regressions.Any()) { return; } var client = new GitHubClient(_productHeaderValue); client.Credentials = new Credentials(_accessToken); var body = new StringBuilder(); body.Append("Some scenarios return errors:"); body.AppendLine(); body.AppendLine(); body.AppendLine("| Scenario | Environment | Last Run | Errors |"); body.AppendLine("| -------- | ----------- | -------- | ------ |"); foreach (var r in regressions.OrderBy(x => x.Scenario).ThenBy(x => x.DateTimeUtc)) { body.AppendLine($"| {r.Scenario} | {r.OperatingSystem}, {r.Hardware}, {r.Scheme}, {r.WebHost} | {r.DateTimeUtc} | {r.Errors} |"); } body .AppendLine() .AppendLine("[Logs](https://aka.ms/aspnet/benchmarks/jenkins)") ; var title = "Bad responses: " + String.Join(", ", regressions.Select(x => x.Scenario).Take(5)); if (regressions.Count() > 5) { title += " ..."; } var createIssue = new NewIssue(title) { Body = body.ToString() }; createIssue.Labels.Add("bad-response"); Console.Write(createIssue.Body); var issue = await client.Issue.Create(_repositoryId, createIssue); }
private async Task CreateIssue(string userName, string title, string description, params string[] labels) { string descriptionFooter = string.IsNullOrEmpty(userName) ? string.Empty : $"Пользователь: {userName}"; var descriptionWithFooter = $"{description}\n{descriptionFooter}".Trim(); var createIssue = new NewIssue(title) { Body = descriptionWithFooter }; var issue = await _client.Issue.Create(OWNER_NAME, REPO_NAME, createIssue); var updateIssue = issue.ToUpdate(); updateIssue.AddAssignee(OWNER_NAME); Array.ForEach(labels, label => updateIssue.AddLabel(label)); await _client.Issue.Update(OWNER_NAME, REPO_NAME, issue.Number, updateIssue); }
public async Task CanAccessUrls() { var expectedUri = "https://api.github.com/repos/{0}/{1}/issues/{2}/{3}"; var newIssue = new NewIssue("A test issue") { Body = "A new unassigned issue" }; var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); Assert.NotNull(issue.CommentsUrl); Assert.Equal(new Uri(string.Format(expectedUri, _context.RepositoryOwner, _context.RepositoryName, issue.Number, "comments")), issue.CommentsUrl); Assert.NotNull(issue.EventsUrl); Assert.Equal(new Uri(string.Format(expectedUri, _context.RepositoryOwner, _context.RepositoryName, issue.Number, "events")), issue.EventsUrl); }
public static async void SendIssue(NewIssue newIssue) { if (newIssue == null) { return; } var issue = await GitHub.Issue.Create("Tsume", "Maple-Tree", newIssue); issue.ToUpdate().State = ItemState.Closed; Helper.InvokeOnCurrentDispatcher(() => { MessageBox.Show($"Navigating to bug report. \n{issue.HtmlUrl}", "Bug Report Submitted"); Process.Start(issue.HtmlUrl); }); }
public virtual Task <Issue> CreateIssue(Data.Repository repo, string title, string message, string assigns) { _client.Credentials = new Credentials(repo.Token); var issue = new NewIssue(title); issue.Body = message; var users = assigns.Split(','); foreach (var item in users) { issue.Assignees.Add(item); } return(_client.Issue.Create(repo.OwnerName, repo.Name, issue)); }
public override async Task <IEnumerable <WorkItemModel> > FileWorkItems(IEnumerable <WorkItemModel> workItemModels) { foreach (WorkItemModel workItemModel in workItemModels) { var newIssue = new NewIssue(workItemModel.Title) { Body = workItemModel.BodyOrDescription }; if (workItemModel.LabelsOrTags?.Count != 0) { foreach (string tag in workItemModel.LabelsOrTags) { newIssue.Labels.Add(tag); } } Issue issue = await _gitHubClient.CreateWorkItemAsync( this.AccountOrOrganization, this.ProjectOrRepository, newIssue); workItemModel.Uri = new Uri(issue.Url, UriKind.Absolute); workItemModel.HtmlUri = new Uri(issue.HtmlUrl, UriKind.Absolute); // TODO: Extend GitHub issue filer to add file attachments // https://github.com/microsoft/sarif-sdk/issues/1754 // TODO: Provide helper that generates useful attachment name from filed bug. // This helper should be common to both ADO and GH filers. The implementation // should work like this: the filer should prefix the proposed file name with // the account and project and number of the filed work item. So an attachment // name of Scan.sarif would be converted tO // // MyAcct_MyProject_WorkItem1000_Scan.sarif // // The GH filer may prefer to use 'issue' instead: // // myowner_my-repo_Issue1000_Scan.sarif // // The common helper should preserve casing choices in the account/owner and // project/repo information that's provided. // // https://github.com/microsoft/sarif-sdk/issues/1753 } return(workItemModels); }
public async Task <Issue> CreateIssueAsync(string title, string content, Milestone milestone, List <string> labels) { var foundRepository = await GetRepositoryAsync($"{_repoOwner}/{_repoName}"); var noticeIssue = new NewIssue(title) { Body = content, Milestone = milestone.Number }; foreach (var label in labels) { noticeIssue.Labels.Add(label); } return(await _githubClient.Issue.Create(foundRepository.Id, noticeIssue)); }
private async void CreateBug(DateTime date, DateTime time, string subject, string message) { try { WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultCredentials; Credentials credentials = new Credentials(Program.AUTH_TOKEN); GitHubClient gh = new GitHubClient(new ProductHeaderValue("ActualProgram")); gh.Credentials = credentials; NewIssue issue = new NewIssue(subject); issue.Body = "[Auto sent from OverSurgery application] " + System.Environment.NewLine + "[Date: " + date.ToShortDateString() + " Time: " + time.ToShortTimeString() + " ]" + System.Environment.NewLine + message; Issue sentIssue = await gh.Issue.Create("TeamTwoAssignmentGroup", "ActualProgram", issue); } catch (Exception e) { Log.WriteLine(e); } }
private static async Task PostIssuesToGitHub(IEnumerable <Thread> threads, string repoOwner, string repoName, string PAT) { var client = new GitHubClient(new ProductHeaderValue("DisqusToGithubIssues")); var basicAuth = new Credentials(PAT); client.Credentials = basicAuth; var issues = await client.Issue.GetAllForRepository(repoOwner, repoName); foreach (var thread in threads) { if (thread.Posts.Count == 0) { continue; } if (issues.Any(x => !x.ClosedAt.HasValue && x.Title.Equals(thread.Title))) { continue; } var newIssue = new NewIssue(thread.Title); newIssue.Body = $@"Written on {thread.CreatedAt} URL: {thread.Url} "; var issue = await client.Issue.Create(repoOwner, repoName, newIssue); Console.WriteLine($"New issue (#{issue.Number}) created: {issue.Url}"); await Task.Delay(1000 * 5); foreach (var post in thread.Posts) { var message = $@"Comment written by **{post.Author}** on **{post.CreatedAt}** {post.Message} "; var comment = await client.Issue.Comment.Create(repoOwner, repoName, issue.Number, message); Console.WriteLine($"New comment by {post.Author} at {post.CreatedAt}"); await Task.Delay(1000 * 5); } } }
public async Task <bool> CreateIssue(string owner, string repo, string title, string body) { try { var issue = new NewIssue(title) { Body = body }; var issueCreated = await _githubClient.Issue.Create(owner, repo, issue); return(issueCreated.Number > 0 ? true : false); } catch (Exception ex) { throw ex; } }
public override async void SaveIssue(Repository repository, NewIssue newIssue) { try { Issue issue = await _github.Issue.Create(repository.Owner.Login, repository.Name, newIssue); if (issue != null && Repository != null && repository.Id == Repository.Repository.Id) { AllIssues.Insert(0, issue);; Issue = issue; } } catch (Exception exception) { _log.Write(LogLevel.Error, "Failed to save issue.", exception); } }
public async Task <string> SubmitIssue(string feedback) { var data = JsonConvert.DeserializeObject <FeedbackModel>(feedback); var client = new GitHubClient(new ProductHeaderValue(GithubProductHeaderValue)); var tokenAuth = new Credentials(GithubApiKeyForCreatingIssues); client.Credentials = tokenAuth; var i = new NewIssue(data.Title) { Body = data.Body }; foreach (var item in data.Labels) { i.Labels.Add(item); } if (Connectivity.NetworkAccess != NetworkAccess.Internet) { return("ConnectionError"); } else { try { var issue = await client.Issue.Create(GithubRepoOwner, GithubRepoName, i); if (issue.State.Value.ToString() == "Open") { return("OK"); } else { return("Error"); } } catch (Exception) { return("Error"); } } }
public async Task CanListIssueEventsForARepository() { // create 2 new issues var newIssue1 = new NewIssue("A test issue1") { Body = "Everything's coming up Millhouse" }; var newIssue2 = new NewIssue("A test issue2") { Body = "A new unassigned issue" }; var issue1 = await _issuesClient.Create(_repositoryOwner, _repository.Name, newIssue1); Thread.Sleep(1000); var issue2 = await _issuesClient.Create(_repositoryOwner, _repository.Name, newIssue2); Thread.Sleep(1000); // close and open issue1 var closed1 = _issuesClient.Update(_repositoryOwner, _repository.Name, issue1.Number, new IssueUpdate { State = ItemState.Closed }) .Result; Assert.NotNull(closed1); var reopened1 = _issuesClient.Update(_repositoryOwner, _repository.Name, issue1.Number, new IssueUpdate { State = ItemState.Open }) .Result; Assert.NotNull(reopened1); // close issue2 var closed2 = _issuesClient.Update(_repositoryOwner, _repository.Name, issue2.Number, new IssueUpdate { State = ItemState.Closed }) .Result; Assert.NotNull(closed2); var issueEvents = await _issuesEventsClientClient.GetForRepository(_repositoryOwner, _repositoryName); Assert.Equal(3, issueEvents.Count); Assert.Equal(2, issueEvents.Count(issueEvent => issueEvent.Issue.Body == "Everything's coming up Millhouse")); }
public Issue CreateIssue([NotNull] string branchId, [NotNull] CreateIssueRequest issue) { var gitHubClient = GetClient(); var newIssue = new NewIssue(issue.Title) { Body = issue.Description }; var result = gitHubClient.Issue.Create( GetSetting(GitHubItSettingKeys.RepositoryOwner), GetSetting(GitHubItSettingKeys.RepositoryName), newIssue) .Result; return(result.ToModel()); }
/// <inheritdoc/> protected override async Task <object> CallGitHubApi(DialogContext dc, Octokit.GitHubClient gitHubClient, CancellationToken cancellationToken = default(CancellationToken)) { if (Owner != null && Name != null && NewIssue != null) { var ownerValue = Owner.GetValue(dc.State); var nameValue = Name.GetValue(dc.State); var newIssueValue = NewIssue.GetValue(dc.State); return(await gitHubClient.Issue.Create(ownerValue, nameValue, newIssueValue).ConfigureAwait(false)); } if (RepositoryId != null && NewIssue != null) { var repositoryIdValue = RepositoryId.GetValue(dc.State); var newIssueValue = NewIssue.GetValue(dc.State); return(await gitHubClient.Issue.Create((Int64)repositoryIdValue, newIssueValue).ConfigureAwait(false)); } throw new ArgumentNullException("Required [newIssue] arguments missing for GitHubClient.Issue.Create"); }
public Task <Issue> OpenTelegramIssue(System.Exception err, dynamic from) { NewIssue createIssue = new NewIssue(err.Message); createIssue.Body = $"## Source: {err.Source} \n" + $"**Telegram id:** {from.Id} \n" + $"**Full name:** {from.FirstName} {from.LastName}\n" + $"**Username:** {from.Username} \n\n" + $"```csharp\n" + $"{err.StackTrace}\n" + $"```"; createIssue.Labels.Add("error"); var issue = _client.Issue.Create("irsooti", "steam-bot", createIssue); return(issue); }
protected override async Task Save() { var newIssue = new NewIssue { Title = IssueTitle, Content = Content ?? string.Empty, Milestone = Milestones.SelectedValue, Responsible = Assignee.SelectedValue, Component = Components.SelectedValue, Version = Versions.SelectedValue, Kind = Kind?.ToLower(), Priority = Priority?.ToLower() }; var issue = await _applicationService.Client.Issues.Create(Username, Repository, newIssue); _messageService.Send(new IssueAddMessage(issue)); }
public async Task CanDeserializeIssue() { const string title = "a test issue"; const string description = "A new unassigned issue"; var newIssue = new NewIssue(title) { Body = description }; var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number); Assert.NotNull(retrieved); Assert.NotEqual(0, issue.Id); Assert.Equal(false, issue.Locked); Assert.Equal(title, retrieved.Title); Assert.Equal(description, retrieved.Body); }
private static async Task <Issue> CreateIssue(string title, string body, List <string> labels) { var issue = new NewIssue(title) { Body = body }; issue.Labels.Add("CodePlex"); foreach (var label in labels) { if (!string.IsNullOrEmpty(label)) { issue.Labels.Add(label); } } return(await client.Issue.Create(gitHubOwner, gitHubRepository, issue)); }
public async Task <string> GetAsync() { var github = new GitHubClient(new ProductHeaderValue("Transparency")); var tokenAuth = new Credentials(Configuration["GitHub:ServiceApiKey"]); github.Credentials = tokenAuth; var user = await github.User.Get("Microhive"); Console.WriteLine(user.Followers + " folks love the half ogre!"); var createIssue = new NewIssue("this thing doesn't work"); var issue = await github.Issue.Create("Microhive", "Transparency", createIssue).ConfigureAwait(true); return($"{user.Name} has {user.PublicRepos} public repositories - go check out their profile at {user.Url}"); }
static async void MainAsync(string[] args) { const String File = "FILENAME"; const String repoOwner = "REPO OWNER"; const String repo = "REPOSITORY"; const string GitToken = "TOKEN"; Dictionary <string, string> UserMapping = new Dictionary <string, string> { { "JohnDorian", "jDorian" }, { "BobKelso", "bKelso" }, { "ElliotReid", "eReid" } }; XDocument xdoc = XDocument.Load(File); var Git = new GitHubClient(new ProductHeaderValue("JiraImporter")); var TokenAuth = new Credentials(GitToken); Git.Credentials = TokenAuth; var items = from p in xdoc.Descendants("item") select p; foreach (var i in items) { Console.WriteLine("Item: " + i.Descendants("summary").First().Value); var Issue = new NewIssue(i.Descendants("summary").First().Value); Issue.Body = i.Descendants("description").First().Value; Issue.Assignee = UserMapping[i.Descendants("assignee").First().Attribute("username").Value]; var itask = Git.Issue.Create(repoOwner, repo, Issue); var issue = await itask; if (i.Descendants("resolution").First().Value == "Done") { var issueUpdate = issue.ToUpdate(); issueUpdate.State = ItemState.Closed; await Git.Issue.Update(repoOwner, repo, issue.Number, issueUpdate); } if (i.Descendants("comments").Count() > 0) { foreach (var comment in i.Descendants("comments").First().Descendants("comment")) { var ctask = Git.Issue.Comment.Create(repoOwner, repo, issue.Number, UserMapping[comment.Attribute("author").Value] + " commented: " + comment.Value); var createdComment = await ctask; } } } }
public async Task CanDeserializeCrossReferenceEventByRepositoryId() { var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var issue = await _issuesClient.Create(_context.Repository.Id, newIssue); newIssue = new NewIssue("another test issue") { Body = "Another new unassigned issue referencing the first new issue in #" + issue.Number }; var anotherNewIssue = await _issuesClient.Create(_context.Repository.Id, newIssue); var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.Repository.Id, issue.Number); Assert.Equal(1, timelineEventInfos.Count); Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id); }
public async Task CreateIssue(Issue issue, Octokit.Repository githubRepo, Milestone relatedMilestone) { var optimizedDescription = issue.Description.Replace("- [ ]", "\r\n- [ ]"); var newIssue = new NewIssue(issue.Title) { Body = optimizedDescription, Milestone = relatedMilestone.Number }; foreach (var label in issue.Labels) { newIssue.Labels.Add(label); } var createdIssue = await GitHubClient.Issue.Create(githubRepo.Id, newIssue); Log($"Issue '{createdIssue.Title}' created (#{createdIssue.Number})"); }
public static void RunPost(NewIssue newIssue, string Login, string Password) { String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(Login + ":" + Password)); HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Basic " + encoded); UriBuilder builder = new UriBuilder("http", "student-rm.exactpro.com", -1, "issues.json"); NameValueCollection query = HttpUtility.ParseQueryString(builder.Query); HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Post, builder.Uri); JavaScriptSerializer serializer = new JavaScriptSerializer(); string json = serializer.Serialize(newIssue); message.Content = new StringContent("{\"issue\":" + json + "}", Encoding.UTF8, "application/json"); Task <HttpResponseMessage> taskResponse = client.SendAsync(message); taskResponse.Wait(); HttpResponseMessage response = taskResponse.Result; if (response.IsSuccessStatusCode) { Task <Stream> streamTask = response.Content.ReadAsStreamAsync(); streamTask.Wait(); if (streamTask.IsCompleted) { Stream responseStream = streamTask.Result; responseStream.Close(); } } else { Console.WriteLine(" response failed. Response status code: [" + response.StatusCode + "]"); } }
public async Task CanListReactions() { var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); Assert.NotNull(issue); var issueReaction = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new NewReaction(ReactionType.Heart)); var issueReactions = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number); Assert.NotEmpty(issueReactions); Assert.Equal(issueReaction.Id, issueReactions[0].Id); Assert.Equal(issueReaction.Content, issueReactions[0].Content); }
public async Task DoesNotChangeLabelsByDefault() { await _issuesClient.Labels.Create(_context.RepositoryOwner, _context.RepositoryName, new NewLabel("something", "FF0000")); var newIssue = new NewIssue("A test issue1") { Body = "A new unassigned issue", }; newIssue.Labels.Add("something"); var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); var issueUpdate = issue.ToUpdate(); var updatedIssue = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate); Assert.Equal(1, updatedIssue.Labels.Count); }
public async Task CanCreateIssueOnRedirectedRepository() { var client = Helper.GetAuthenticatedClient(); var owner = "shiftkey-tester"; var oldRepoName = "repository-before-rename"; var newRepoName = "repository-after-rename"; var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var issue = await client.Issue.Create(owner, oldRepoName, newIssue); Assert.NotNull(issue); Assert.True(issue.Url.AbsoluteUri.Contains("repository-after-rename")); var resolvedIssue = await client.Issue.Get(owner, newRepoName, issue.Number); Assert.NotNull(resolvedIssue); var update = resolvedIssue.ToUpdate(); update.State = ItemState.Closed; await client.Issue.Update(owner, oldRepoName, issue.Number, update); }
public async Task CanRetrieveTimelineForIssueByRepositoryId() { var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var observable = _client.Issue.Create(_context.Repository.Id, newIssue); var issue = await observable; var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.Repository.Id, issue.Number); var timelineEventInfos = await observableTimeline.ToList(); Assert.Empty(timelineEventInfos); observable = _client.Issue.Update(_context.Repository.Id, issue.Number, new IssueUpdate { State = ItemState.Closed }); var closed = await observable; Assert.NotNull(closed); observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.Repository.Id, issue.Number); timelineEventInfos = await observableTimeline.ToList(); Assert.Equal(1, timelineEventInfos.Count); Assert.Equal(EventInfoState.Closed, timelineEventInfos[0].Event); }
/// <summary> /// Creates an issue for the specified repository. Any user with pull access to a repository can create an /// issue. /// </summary> /// <remarks>http://developer.github.com/v3/issues/#create-an-issue</remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="newIssue">A <see cref="NewIssue"/> instance describing the new issue to create</param> /// <returns></returns> public IObservable<Issue> Create(string owner, string name, NewIssue newIssue) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(newIssue, "newIssue"); return _client.Create(owner, name, newIssue).ToObservable(); }
/// <summary> /// Creates an issue for the specified repository. Any user with pull access to a repository can create an /// issue. /// </summary> /// <remarks>http://developer.github.com/v3/issues/#create-an-issue</remarks> /// <param name="repositoryId">The ID of the repository</param> /// <param name="newIssue">A <see cref="NewIssue"/> instance describing the new issue to create</param> public IObservable<Issue> Create(int repositoryId, NewIssue newIssue) { Ensure.ArgumentNotNull(newIssue, "newIssue"); return _client.Create(repositoryId, newIssue).ToObservable(); }
public async Task CanDeserializeCrossReferenceEventByRepositoryId() { var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var observable = _client.Issue.Create(_context.Repository.Id, newIssue); var issue = await observable; newIssue = new NewIssue("another test issue") { Body = "Another new unassigned issue referencing the first new issue in #" + issue.Number }; observable = _client.Issue.Create(_context.Repository.Id, newIssue); var anotherNewIssue = await observable; var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.Repository.Id, issue.Number); var timelineEventInfos = await observableTimeline.ToList(); Assert.Equal(1, timelineEventInfos.Count); Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Id); }
public void PostsToCorrectUrl() { var newIssue = new NewIssue("some title"); var connection = Substitute.For<IApiConnection>(); var client = new IssuesClient(connection); client.Create("fake", "repo", newIssue); connection.Received().Post<Issue>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues"), newIssue); }
public async Task CanDeserializeRenameEventByRepositoryId() { var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var observable = _client.Issue.Create(_context.Repository.Id, newIssue); var issue = await observable; observable = _client.Issue.Update(_context.Repository.Id, issue.Number, new IssueUpdate { Title = "A test issue" }); var renamed = await observable; Assert.NotNull(renamed); Assert.Equal("A test issue", renamed.Title); var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.Repository.Id, issue.Number); var timelineEventInfos = await observableTimeline.ToList(); Assert.Equal(1, timelineEventInfos.Count); Assert.Equal("a test issue", timelineEventInfos[0].Rename.From); Assert.Equal("A test issue", timelineEventInfos[0].Rename.To); }
public void CreatesFromClientIssueIssue() { var newIssue = new NewIssue("some title"); var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssuesClient(gitHubClient); client.Create("fake", "repo", newIssue); gitHubClient.Issue.Received().Create("fake", "repo", newIssue); }