Exemple #1
0
        public async Task TestAttachment()
        {
            const string filename    = "test.txt";
            const string testContent = "Testing 1 2 3";
            var          attachment  = await _jiraApi.AttachAsync("FEATURE-746", testContent, filename);

            Assert.NotNull(attachment);
            Assert.StartsWith("text/plain", attachment.MimeType);

            if (attachment.ThumbnailUri != null)
            {
                var attachmentThumbnail = await _jiraApi.GetAttachmentThumbnailAsAsync <Bitmap>(attachment);

                Assert.NotNull(attachmentThumbnail);
                Assert.True(attachmentThumbnail.Width > 0);
            }

            var returnedContent = await _jiraApi.GetAttachmentContentAsAsync <string>(attachment);

            Assert.Equal(testContent, returnedContent);

            bool hasBeenRemoved = false;
            var  issue          = await _jiraApi.GetIssueAsync("FEATURE-746");

            foreach (var attachment2Delete in issue.Fields.Attachments.Where(x => x.Filename == filename))
            {
                Log.Info().WriteLine("Deleting {0} from {1}", attachment2Delete.Filename, attachment2Delete.Created);
                await _jiraApi.DeleteAttachmentAsync(attachment2Delete);

                hasBeenRemoved = true;
            }

            Assert.True(hasBeenRemoved);
        }
Exemple #2
0
        /// <summary>
        ///     Override ProcessRecordAsync to get the issue data and output the object
        /// </summary>
        /// <returns></returns>
        protected override async Task ProcessRecordAsync()
        {
            var issue = await JiraApi.GetIssueAsync(IssueKey);

            WriteObject(issue.Fields);
        }