本文整理汇总了C#中Octokit.NewIssue类的典型用法代码示例。如果您正苦于以下问题:C# NewIssue类的具体用法?C# NewIssue怎么用?C# NewIssue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NewIssue类属于Octokit命名空间,在下文中一共展示了NewIssue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Index
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();
}
示例2: CanListIssueEventsForARepository
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"));
}
示例3: SendIssueReportAsync
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);
}
示例4: ReturnsCorrectCountOfIssueLabelsWithoutStartForAnIssue
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);
}
示例5: PopulateIssue
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;
}
示例6: Should_assign_label_to_match_original_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);
}
示例7: CanListIssuesWithAscendingSort
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);
}
示例8: ReturnsAllIssuesForOwnedAndMemberRepositories
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);
}
示例9: ReturnsAllIssuesForOwnedAndMemberRepositories
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);
}
示例10: CanCreateAndUpdateIssues
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);
}
示例11: ReturnsAllIssuesForCurrentUser
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);
}
示例12: PostsToCorrectUrl
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);
}
示例13: CreateIssue
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);
}
}
示例14: CanDeserializeIssue
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);
}
示例15: CanRetrieveIssueEventById
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);
}