public async Task<ActionResult> Index(string idea, string description) { if (idea == "" || idea == null) { ViewBag.Message = "Enter an idea yo!"; ViewBag.ImgUrl = "homerSad.jpg"; return View(); } try { var client = new GitHubClient(new ProductHeaderValue("Nommer-Idea-Lodger")); client.Credentials = new Credentials(Environment.GetEnvironmentVariable("GithubKey")); var newIdea = new NewIssue(idea) { Body = description }; newIdea.Labels.Add("idea"); await client.Issue.Create("NickBrooks", "Nommer-Roadmap", newIdea); ViewBag.Message = "You're an ideas man!"; ViewBag.ImgUrl = "homerHappy.jpg"; } catch (Exception ex) { ViewBag.ImgUrl = "homerSad.jpg"; ViewBag.Message = ex.ToString(); } return View(); }
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 async Task SendIssueReportAsync(IssueReport report) { var appId = _propertyProvider.GetProperty("locco.github.appId"); var accessToken = _propertyProvider.GetProperty("locco.github.token"); var repoOwner = _propertyProvider.GetProperty("locco.github.owner"); var repoName = _propertyProvider.GetProperty("locco.github.repository"); // Support default proxy var proxy = WebRequest.DefaultWebProxy; var httpClient = new HttpClientAdapter(() => HttpMessageHandlerFactory.CreateDefault(proxy)); var connection = new Connection(new ProductHeaderValue(appId), httpClient); if (proxy != null) { Log.Info(string.Format("Using proxy server '{0}' to connect to github!", proxy.GetProxy(new Uri("https://api.github.com/")))); } var client = new GitHubClient(connection) { Credentials = new Credentials(accessToken) }; // Creates a new GitHub Issue var newIssue = new NewIssue(report.Title) { Body = MarkdownReportUtil.CompileBodyMarkdown(report, 220000), }; newIssue.Labels.Add("bot"); var issue = await client.Issue.Create(repoOwner, repoName, newIssue); }
public async Task ReturnsCorrectCountOfIssueLabelsWithoutStartForAnIssue() { var newIssue = new NewIssue("A test issue") { Body = "A new unassigned issue" }; var newLabel = new NewLabel("test label", "FFFFFF"); var label = await _issuesLabelsClient.Create(_context.RepositoryOwner, _context.RepositoryName, newLabel); var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); var issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); Assert.Empty(issueLabelsInfo); var issueUpdate = new IssueUpdate(); issueUpdate.AddLabel(label.Name); var updated = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate); Assert.NotNull(updated); var options = new ApiOptions { PageCount = 1, PageSize = 1 }; issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options); Assert.Equal(1, issueLabelsInfo.Count); Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color); }
private NewIssue PopulateIssue(TestCase testCase) { NewIssue issue = new NewIssue(string.Format("[Bug] {0}", testCase.Title)); StringBuilder bodyBuilder = bodyBuilder = new StringBuilder(); bodyBuilder.AppendLine("## Steps to reproduce"); bodyBuilder.AppendLine(); int counter = 1; foreach (var stepDefinition in new TestManager().GetStepDefinitionsById(testCase.ID)) { if (string.IsNullOrWhiteSpace(stepDefinition.ExpectedResult) == false) bodyBuilder.AppendLine(string.Format("{0}. {1} - *Expected result:* {2}", counter, stepDefinition.Step, stepDefinition.ExpectedResult)); else bodyBuilder.AppendLine(string.Format("{0}. {1}", counter, stepDefinition.Step)); counter++; } bodyBuilder.AppendLine(); bodyBuilder.AppendLine("## Additinal info"); bodyBuilder.AppendLine(); bodyBuilder.AppendLine(string.Format("**Test case ID :** {0}", testCase.ID)); bodyBuilder.AppendLine(string.Format("**Severity :** {0}", testCase.Severity)); bodyBuilder.AppendLine(string.Format("**Priority :** {0}", testCase.Priority)); bodyBuilder.AppendLine(string.Format("**Created by :** {0}", testCase.CreatedBy)); bodyBuilder.AppendLine(string.Format("**Is Automated :** {0}", testCase.IsAutomated)); issue.Body = bodyBuilder.ToString(); return issue; }
public async Task Should_assign_label_to_match_original_issue() { // arrange var sourceLabel = await GitHubClient.Issue.Labels.Create( SourceRepository.Owner.Login, SourceRepository.Name, new NewLabel("Test-Label", "123456")); var newSourceIssue = new NewIssue("test issue with label") { Body = "Issue should have a label" }; newSourceIssue.Labels.Add(sourceLabel.Name); var sourceIssue = await GitHubClient.Issue.Create( SourceRepository.Owner.Login, SourceRepository.Name, newSourceIssue); // act var targetIssue = await IssueUtility.Transfer( SourceRepository.Owner.Login, SourceRepository.Name, sourceIssue.Number, TargetRepository.Owner.Login, TargetRepository.Name, true); // assert Assert.AreEqual(1, targetIssue.Labels.Count); Assert.AreEqual(sourceIssue.Labels.Single().Name, targetIssue.Labels.Single().Name); Assert.AreEqual(sourceIssue.Labels.Single().Color, targetIssue.Labels.Single().Color); }
public async Task CanListIssuesWithAscendingSort() { string owner = _repository.Owner.Login; var newIssue1 = new NewIssue("A test issue1") { Body = "A new unassigned issue" }; var newIssue2 = new NewIssue("A test issue2") { Body = "A new unassigned issue" }; var newIssue3 = new NewIssue("A test issue3") { Body = "A new unassigned issue" }; var newIssue4 = new NewIssue("A test issue4") { Body = "A new unassigned issue" }; await _issuesClient.Create(owner, _repository.Name, newIssue1); Thread.Sleep(1000); await _issuesClient.Create(owner, _repository.Name, newIssue2); Thread.Sleep(1000); await _issuesClient.Create(owner, _repository.Name, newIssue3); var closed = await _issuesClient.Create(owner, _repository.Name, newIssue4); await _issuesClient.Update(owner, _repository.Name, closed.Number, new IssueUpdate { State = ItemState.Closed }); var issues = await _issuesClient.GetForRepository(owner, _repository.Name, new RepositoryIssueRequest {SortDirection = SortDirection.Ascending}); Assert.Equal(3, issues.Count); Assert.Equal("A test issue1", issues[0].Title); Assert.Equal("A test issue2", issues[1].Title); Assert.Equal("A test issue3", issues[2].Title); }
public async Task ReturnsAllIssuesForOwnedAndMemberRepositories() { var newIssue = new NewIssue("Integration test issue") { Assignee = _context.RepositoryOwner }; await _client.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); var result = await _client.GetAllForOwnedAndMemberRepositories().ToList(); Assert.NotEmpty(result); }
public async Task ReturnsAllIssuesForOwnedAndMemberRepositories() { var newIssue = new NewIssue("Integration test issue"); await _client.Create(_createdRepository.Owner.Login, _repoName, newIssue); var result = await _client.GetAllForOwnedAndMemberRepositories().ToList(); Assert.NotEmpty(result); }
public async Task CanCreateAndUpdateIssues() { var newIssue = new NewIssue("Integration test issue"); var createResult = await _client.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); var updateResult = await _client.Update(_context.RepositoryOwner, _context.RepositoryName, createResult.Number, new IssueUpdate { Title = "Modified integration test issue" }); Assert.Equal("Modified integration test issue", updateResult.Title); }
public async Task ReturnsAllIssuesForCurrentUser() { var newIssue = new NewIssue("Integration test issue") { Assignee = _context.RepositoryOwner }; await _client.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); var issues = await _client.GetAllForCurrent().ToList(); Assert.NotEmpty(issues); }
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); }
private async Task CreateIssue(CodePlexIssue codePlexIssue) { var codePlexIssueUrl = string.Format("http://{0}.codeplex.com/workitem/{1}", _options.CodeplexProject, codePlexIssue.Id); var description = new StringBuilder(); description.AppendFormat("<sub>This issue was imported from [CodePlex]({0})</sub>", codePlexIssueUrl); description.AppendLine(); description.AppendLine(); description.AppendFormat(CultureInfo.InvariantCulture, "**[{0}](https://github.com/{0})** <sup>wrote {1:yyyy-MM-dd} at {1:HH:mm}</sup>", codePlexIssue.ReportedBy, codePlexIssue.Time); description.AppendLine(); description.Append(FormatForGithub(codePlexIssue.Description)); var labels = new List<string>(); if (codePlexIssue.Type == "Feature") { labels.Add("enhancement"); } // if (codePlexIssue.Type == "Issue") // labels.Add("bug"); // if (codePlexIssue.Impact == "Low" || codePlexIssue.Impact == "Medium" || codePlexIssue.Impact == "High") // labels.Add(issue.Impact); var issue = new NewIssue(codePlexIssue.Title) { Body = description.ToString().Trim() }; if (_options.AddCodePlexLabel) { issue.Labels.Add("CodePlex"); } foreach (var label in labels) { if (!string.IsNullOrEmpty(label)) { issue.Labels.Add(label); } } var gitHubIssue = await _gitHubClient.Issue.Create(_options.GitHubOwner, _options.GitHubRepository, issue); var commentsCount = codePlexIssue.Comments.Count; var n = 0; foreach (var comment in codePlexIssue.Comments) { Console.WriteLine("{0} - > Adding Comment {1}/{2} by {3}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ++n, commentsCount, comment.Author); await CreateComment(gitHubIssue.Number, comment); } if (codePlexIssue.IsClosed()) { await CloseIssue(gitHubIssue); } }
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); }
public async Task CanRetrieveIssueEventById() { var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var issue = await _issuesClient.Create(_repositoryOwner, _repositoryName, newIssue); var closed = _issuesClient.Update(_repositoryOwner, _repository.Name, issue.Number, new IssueUpdate { State = ItemState.Closed }) .Result; Assert.NotNull(closed); var issueEvents = await _issuesEventsClientClient.GetForRepository(_repositoryOwner, _repositoryName); int issueEventId = issueEvents[0].Id; var issueEventLookupById = await _issuesEventsClientClient.Get(_repositoryOwner, _repositoryName, issueEventId); Assert.Equal(issueEventId, issueEventLookupById.Id); Assert.Equal(issueEvents[0].InfoState, issueEventLookupById.InfoState); }
public async Task CanListEventInfoForAnIssueWithRepositoryId() { var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); var issueEventInfo = await _issuesEventsClient.GetAllForIssue(_context.Repository.Id, issue.Number); Assert.Empty(issueEventInfo); var closed = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed }); Assert.NotNull(closed); issueEventInfo = await _issuesEventsClient.GetAllForIssue(_context.Repository.Id, issue.Number); Assert.Equal(1, issueEventInfo.Count); Assert.Equal(EventInfoState.Closed, issueEventInfo[0].Event); }
public async Task CanListReactionsWithRepositoryId() { 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.Repository.Id, issue.Number); Assert.NotEmpty(issueReactions); Assert.Equal(issueReaction.Id, issueReactions[0].Id); Assert.Equal(issueReaction.Content, issueReactions[0].Content); }
public async Task CanCreateReactionWithRepositoryId() { 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.Repository.Id, issue.Number, new NewReaction(ReactionType.Heart)); Assert.NotNull(issueReaction); Assert.IsType<Reaction>(issueReaction); Assert.Equal(ReactionType.Heart, issueReaction.Content); Assert.Equal(issue.User.Id, issueReaction.User.Id); }
public async Task ReturnsCorrectCountOfEventInfosWithoutStartWithRepositoryId() { var newIssue = new NewIssue("issue 1") { Body = "A new unassigned issue" }; var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number); await _issuesClient.Unlock(_context.RepositoryOwner, _context.RepositoryName, issue.Number); await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number); var options = new ApiOptions { PageSize = 3, PageCount = 1 }; var eventInfos = await _issuesEventsClient.GetAllForIssue(_context.Repository.Id, issue.Number, options); Assert.Equal(3, eventInfos.Count); }
public async Task CanCreateReaction() { 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); foreach (ReactionType reactionType in Enum.GetValues(typeof(ReactionType))) { var newReaction = new NewReaction(reactionType); var reaction = await _github.Reaction.CommitComment.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Id, newReaction); Assert.IsType<Reaction>(reaction); Assert.Equal(reactionType, reaction.Content); Assert.Equal(issue.User.Id, reaction.User.Id); } }
public async Task CanDeserializeIssueWithRepositoryId() { 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.Repository.Id, newIssue); Assert.True(issue.Id > 0); Assert.False(issue.Locked); Assert.Equal(title, issue.Title); Assert.Equal(description, issue.Body); var retrieved = await _issuesClient.Get(_context.Repository.Id, issue.Number); Assert.True(retrieved.Id > 0); Assert.False(retrieved.Locked); Assert.Equal(title, retrieved.Title); Assert.Equal(description, retrieved.Body); }
public async Task CanListLabelsForAnIssue() { var newIssue = new NewIssue("A test issue") { Body = "A new unassigned issue" }; var newLabel = new NewLabel("test label", "FFFFFF"); var label = await _issuesLabelsClient.Create(_repositoryOwner, _repository.Name, newLabel); var issue = await _issuesClient.Create(_repositoryOwner, _repositoryName, newIssue); var issueLabelsInfo = await _issuesLabelsClient.GetForIssue(_repositoryOwner, _repositoryName, issue.Number); Assert.Empty(issueLabelsInfo); var issueUpdate = new IssueUpdate(); issueUpdate.Labels.Add(label.Name); var updated = await _issuesClient.Update(_repositoryOwner, _repository.Name, issue.Number, issueUpdate); Assert.NotNull(updated); issueLabelsInfo = await _issuesLabelsClient.GetForIssue(_repositoryOwner, _repositoryName, issue.Number); Assert.Equal(1, issueLabelsInfo.Count); Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color); }
public async Task CanCreateRetrieveAndCloseIssue() { var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); try { Assert.NotNull(issue); var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number); var all = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName); Assert.NotNull(retrieved); Assert.True(all.Any(i => i.Number == retrieved.Number)); } finally { var closed = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed }) .Result; Assert.NotNull(closed); } }
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 CanListOpenIssuesWithDefaultSort() { var newIssue1 = new NewIssue("A test issue1") { Body = "A new unassigned issue" }; var newIssue2 = new NewIssue("A test issue2") { Body = "A new unassigned issue" }; var newIssue3 = new NewIssue("A test issue3") { Body = "A new unassigned issue" }; var newIssue4 = new NewIssue("A test issue4") { Body = "A new unassigned issue" }; await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue1); Thread.Sleep(1000); await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue2); Thread.Sleep(1000); await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue3); var closed = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue4); await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, closed.Number, new IssueUpdate { State = ItemState.Closed }); var issues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName); Assert.Equal(3, issues.Count); Assert.Equal("A test issue3", issues[0].Title); Assert.Equal("A test issue2", issues[1].Title); Assert.Equal("A test issue1", issues[2].Title); }
public async Task CanAssignAndUnassignMilestone() { var owner = _repository.Owner.Login; var newMilestone = new NewMilestone("a milestone"); var milestone = await _issuesClient.Milestone.Create(owner, _repository.Name, newMilestone); var newIssue1 = new NewIssue("A test issue1") { Body = "A new unassigned issue", Milestone = milestone.Number }; var issue = await _issuesClient.Create(owner, _repository.Name, newIssue1); Assert.NotNull(issue.Milestone); var issueUpdate = issue.ToUpdate(); issueUpdate.Milestone = null; var updatedIssue = await _issuesClient.Update(owner, _repository.Name, issue.Number, issueUpdate); Assert.Null(updatedIssue.Milestone); }
public async Task CanFilterByMentioned() { var owner = _repository.Owner.Login; var newIssue1 = new NewIssue("An issue") { Body = "words words words hello there @shiftkey" }; var newIssue2 = new NewIssue("Another issue") { Body = "some other words" }; await _issuesClient.Create(owner, _repository.Name, newIssue1); await _issuesClient.Create(owner, _repository.Name, newIssue2); var allIssues = await _issuesClient.GetForRepository(owner, _repository.Name, new RepositoryIssueRequest()); Assert.Equal(2, allIssues.Count); var mentionsWithShiftkey = await _issuesClient.GetForRepository(owner, _repository.Name, new RepositoryIssueRequest { Mentioned = "shiftkey" }); Assert.Equal(1, mentionsWithShiftkey.Count); var mentionsWithHaacked = await _issuesClient.GetForRepository(owner, _repository.Name, new RepositoryIssueRequest { Mentioned = "haacked" }); Assert.Equal(0, mentionsWithHaacked.Count); }
public async Task CanFilterByCreator() { var owner = _repository.Owner.Login; var newIssue1 = new NewIssue("An issue") { Body = "words words words" }; var newIssue2 = new NewIssue("Another issue") { Body = "some other words" }; await _issuesClient.Create(owner, _repository.Name, newIssue1); await _issuesClient.Create(owner, _repository.Name, newIssue2); var allIssues = await _issuesClient.GetForRepository(owner, _repository.Name, new RepositoryIssueRequest()); Assert.Equal(2, allIssues.Count); var issuesCreatedByOwner = await _issuesClient.GetForRepository(owner, _repository.Name, new RepositoryIssueRequest { Creator = owner }); Assert.Equal(2, issuesCreatedByOwner.Count); var issuesCreatedByExternalUser = await _issuesClient.GetForRepository(owner, _repository.Name, new RepositoryIssueRequest { Creator = "shiftkey" }); Assert.Equal(0, issuesCreatedByExternalUser.Count); }
public async Task CanFilterByAssigned() { var owner = _repository.Owner.Login; var newIssue1 = new NewIssue("An assigned issue") { Body = "Assigning this to myself", Assignee = owner }; var newIssue2 = new NewIssue("An unassigned issue") { Body = "A new unassigned issue" }; await _issuesClient.Create(owner, _repository.Name, newIssue1); await _issuesClient.Create(owner, _repository.Name, newIssue2); var allIssues = await _issuesClient.GetForRepository(owner, _repository.Name, new RepositoryIssueRequest()); Assert.Equal(2, allIssues.Count); var assignedIssues = await _issuesClient.GetForRepository(owner, _repository.Name, new RepositoryIssueRequest { Assignee = owner }); Assert.Equal(1, assignedIssues.Count); Assert.Equal("An assigned issue", assignedIssues[0].Title); var unassignedIssues = await _issuesClient.GetForRepository(owner, _repository.Name, new RepositoryIssueRequest { Assignee = "none" }); Assert.Equal(1, unassignedIssues.Count); Assert.Equal("An unassigned issue", unassignedIssues[0].Title); }
public async Task CanRetrieveClosedIssues() { string owner = _repository.Owner.Login; var newIssue = new NewIssue("A test issue") { Body = "A new unassigned issue" }; var issue1 = await _issuesClient.Create(owner, _repository.Name, newIssue); var issue2 = await _issuesClient.Create(owner, _repository.Name, newIssue); await _issuesClient.Update(owner, _repository.Name, issue1.Number, new IssueUpdate { State = ItemState.Closed }); await _issuesClient.Update(owner, _repository.Name, issue2.Number, new IssueUpdate { State = ItemState.Closed }); var retrieved = await _issuesClient.GetForRepository(owner, _repository.Name, new RepositoryIssueRequest { State = ItemState.Closed }); Assert.True(retrieved.Count >= 2); Assert.True(retrieved.Any(i => i.Number == issue1.Number)); Assert.True(retrieved.Any(i => i.Number == issue2.Number)); }
/// <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 Task <Issue> Create(int repositoryId, NewIssue newIssue) { Ensure.ArgumentNotNull(newIssue, "newIssue"); return(ApiConnection.Post <Issue>(ApiUrls.Issues(repositoryId), newIssue)); }