public async Task CanAddAttachmentToTicketAsync()
{
var res = await api.Attachments.UploadAttachmentAsync(new ZenFile()
{
ContentType = "text/plain",
FileName = "testupload.txt",
FileData = File.ReadAllBytes(TestContext.CurrentContext.TestDirectory + "\\testupload.txt")
});
var ticket = new Ticket()
{
Subject = "testing attachments",
Priority = TicketPriorities.Normal,
Comment = new Comment()
{
Body = "comments are required for attachments",
Public = true,
Uploads = new List<string>() { res.Token }
},
};
var t1 = await api.Tickets.CreateTicketAsync(ticket);
Assert.AreEqual(t1.Audit.Events.First().Attachments.Count, 1);
Assert.True(await api.Tickets.DeleteAsync(t1.Ticket.Id.Value));
}