本文整理汇总了C#中Issue.AddAttachment方法的典型用法代码示例。如果您正苦于以下问题:C# Issue.AddAttachment方法的具体用法?C# Issue.AddAttachment怎么用?C# Issue.AddAttachment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Issue
的用法示例。
在下文中一共展示了Issue.AddAttachment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttachScreenShot
public static void AttachScreenShot(Issue issue, Image img)
{
if (img != null)
{
issue.AddAttachment("screenshot.png", ConvertImage(img));
}
issue.SaveChanges();
}
示例2: can_save_new_issue
public void can_save_new_issue()
{
Company company = new Company();
company.Name = "Test Company";
company.CreateAndFlush();
Issue issue = new Issue();
issue.Title = "Test issue";
issue.Type = IssueType.Defect;
IssueNote note = new IssueNote();
note.Body = "Test note";
issue.AddNote(note);
IssueChange change = new IssueChange();
change.PropertyName = "Test change";
issue.AddChange(change);
IssueAttachment att = new IssueAttachment();
att.Body = new byte[10];
att.Title = "Test attachment";
issue.AddAttachment(att);
Project project = new Project();
project.Company = company;
project.AddIssue(issue);
project.Name = "Test project";
project.CreateAndFlush();
using (SessionScope newScope = new SessionScope())
{
Issue actual = Issue.Find(issue.Id);
Assert.AreEqual("Test issue", actual.Title);
Assert.AreEqual("Test note", actual.Notes[0].Body);
Assert.AreEqual("Test change", actual.Changes[0].PropertyName);
Assert.AreEqual("Test attachment", actual.Attachments[0].Title);
}
project.DeleteAndFlush();
company.DeleteAndFlush();
}