Пример #1
0
        public void CreateAnIssueAttachmentsLarger2mb()
        {
            #region Parameters
            List <string> dataProject = ProjectsBDSteps.ReturnProjectByNameRandom();
            string        nameProject = dataProject[0];

            string summary      = "Automation Test Api RestSharp";
            string description  = "Description " + GeneralHelpers.ReturnStringWithRandomCharacters(5);
            string categoryName = "General";

            string nameFile = "test.pdf";
            string path     = GeneralHelpers.ReturnProjectPath() + @"Resources/user-handbook.pdf";

            // Expected Result
            string statusCodeExpected = "BadRequest";
            int    statusCode         = 400;
            string message            = "File '" + nameFile + "' too big";
            #endregion

            #region Request
            issueAttachments = new POST_CreateIssueWithAtttachmentsRequest();

            issueAttachments.SetJsonBody(path, nameFile, nameProject, summary, description, categoryName);

            issueAttachments.addFile(nameFile, path);

            response = issueAttachments.ExecuteRequest();
            #endregion


            #region Assert
            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeExpected, response.StatusCode.ToString());
                Assert.AreEqual(statusCode, (int)response.StatusCode);
                Assert.AreEqual(message, response.Data["message"].ToString());
            });
            #endregion
        }
Пример #2
0
        public void CreateAnIssueAttachmentsSucess()
        {
            #region Parameters
            List <string> dataProject = ProjectsBDSteps.ReturnProjectByNameRandom();
            string        nameProject = dataProject[0];

            string summary      = "Automation Test Api RestSharp";
            string description  = "Description " + GeneralHelpers.ReturnStringWithRandomCharacters(5);
            string categoryName = "General";

            string nameFile = "test.pdf";
            string path     = GeneralHelpers.ReturnProjectPath() + @"Resources/test.pdf";

            // Expected Result
            string statusCodeExpected = "Created";
            #endregion

            #region Request
            issueAttachments = new POST_CreateIssueWithAtttachmentsRequest();

            issueAttachments.SetJsonBody(path, nameFile, nameProject, summary, description, categoryName);

            issueAttachments.addFile(nameFile, path);

            response = issueAttachments.ExecuteRequest();
            #endregion


            #region Assert
            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeExpected, response.StatusCode.ToString());
                Assert.AreEqual(summary, response.Data["issue"]["summary"].ToString());
                Assert.AreEqual(description, response.Data["issue"]["description"].ToString());
                Assert.AreEqual(nameProject, response.Data["issue"]["project"]["name"].ToString());
            });
            #endregion
        }