コード例 #1
0
        public void CreateNoteInIssueErro()
        {
            #region Parameters
            List <string> dataIssue = IssuesBDSteps.ReturnIdIssuesRandom();

            string issue_id       = dataIssue[0];
            string nameView_state = "";
            string text           = "";

            //Expected Result
            string statusCodeExpected = "BadRequest";
            string message            = "Issue note not specified.";
            string code      = "11";
            string localized = "A necessary field \"Note\" was empty. Please recheck your inputs.";
            #endregion

            #region Request
            noteIssue = new POST_CreateNoteInIssueRequest(issue_id);

            noteIssue.SetJsonBody(nameView_state, text);

            response = noteIssue.ExecuteRequest();
            #endregion

            #region Assert
            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeExpected, response.StatusCode.ToString());
                Assert.AreEqual(message, response.Data["message"].ToString());
                Assert.AreEqual(code, response.Data["code"].ToString());
                Assert.AreEqual(localized, response.Data["localized"].ToString());
            });
            #endregion
        }
コード例 #2
0
        public void CreateNoteInIssueDataDriven(ArrayList dataTest)
        {
            #region Parameters
            List <string> dataIssue = IssuesBDSteps.ReturnIdIssuesRandom();
            string        issue_id  = dataIssue[0];

            string nameView_state = "";
            string text           = dataTest[0].ToString();

            //Expected Result
            string statusCodeEsperado = "Created";

            #endregion

            #region Request
            noteIssue = new POST_CreateNoteInIssueRequest(issue_id);

            noteIssue.SetJsonBody(nameView_state, text);

            response = noteIssue.ExecuteRequest();
            #endregion

            #region Assert
            Assert.AreEqual(statusCodeEsperado, response.StatusCode.ToString());
            #endregion
        }
コード例 #3
0
        public void CreateNoteInIssueSucess()
        {
            #region Parameters
            List <string> dataIssue = IssuesBDSteps.ReturnIdIssuesRandom();
            string        issue_id  = dataIssue[0];

            string viewStatus = "private";
            string text       = "test note " + GeneralHelpers.ReturnStringWithRandomCharacters(10);

            //Expected Result
            string statusCodeEsperado = "Created";

            #endregion

            #region Request
            noteIssue = new POST_CreateNoteInIssueRequest(issue_id);

            noteIssue.SetJsonBody(viewStatus, text);

            response = noteIssue.ExecuteRequest();
            #endregion

            #region Assert
            Assert.AreEqual(statusCodeEsperado, response.StatusCode.ToString());
            #endregion
        }
コード例 #4
0
        public void DeleteAnIssueNoteIdZero()
        {
            #region Parameters
            List <string> dataIssue = IssuesBDSteps.ReturnIdIssuesRandom();

            string issue_id      = dataIssue[0];
            string issue_note_id = "0";

            //Expected Result
            string message            = "'id' must be >= 1";
            string code               = "29";
            string localized          = "Invalid value for 'id'";
            string statusCodeExpected = "BadRequest";
            #endregion

            #region Request
            deleteNote = new DEL_OneNoteRequest(issue_id, issue_note_id);

            response = deleteNote.ExecuteRequest();
            #endregion

            #region Assert
            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeExpected, response.StatusCode.ToString());
                Assert.AreEqual(message, response.Data["message"].ToString());
                Assert.AreEqual(code, response.Data["code"].ToString());
                Assert.AreEqual(localized, response.Data["localized"].ToString());
            });
            #endregion
        }
コード例 #5
0
        public void DeleteAnIssueNoteDataInvalida()
        {
            #region Parameters
            List <string> dataIssue = IssuesBDSteps.ReturnIdIssuesRandom();

            string issue_id      = dataIssue[0];
            string issue_note_id = "1988a";

            //Expected Result
            string statusCodeExpected = "NotFound";
            string message            = "Issue note #1988a not found";
            string code      = "600";
            string localized = "Note not found.";
            #endregion

            #region Request
            deleteNote = new DEL_OneNoteRequest(issue_id, issue_note_id);

            response = deleteNote.ExecuteRequest();
            #endregion

            #region Assert
            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeExpected, response.StatusCode.ToString());
                Assert.AreEqual(message, response.Data["message"].ToString());
                Assert.AreEqual(code, response.Data["code"].ToString());
                Assert.AreEqual(localized, response.Data["localized"].ToString());
            });
            #endregion
        }
コード例 #6
0
        public void UpdateAnIssueNoRightParameter()
        {
            #region Parameters
            List <string> issue_id = IssuesBDSteps.ReturnIdIssuesRandom();

            string idProblema = issue_id[0];

            string summary      = "";
            string categoryName = "Gene";

            //Expected Result
            string statusCodeExpected = "OK";
            string statusResponse     = "Error";

            #endregion

            #region Request
            updateIsse = new PUT_UpdateOneIssueRequest(idProblema);

            updateIsse.SetJsonBoby(summary, categoryName);

            response = updateIsse.ExecuteRequest();
            #endregion

            #region Assert
            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeExpected, response.StatusCode.ToString());
                Assert.AreEqual(statusResponse, response.ResponseStatus.ToString());
            });
            #endregion
        }
コード例 #7
0
        public void UpdateAnIssue()
        {
            #region Parameters
            List <string> issue_id = IssuesBDSteps.ReturnIdIssuesRandom();

            string idProblema = issue_id[0];

            string summary      = "Test API Rest Update " + GeneralHelpers.ReturnStringWithRandomNumbers(2);
            string categoryName = "Rest Automation API Updaten" + GeneralHelpers.ReturnStringWithRandomNumbers(2);

            //Expected Result
            string statusCodeExpected = "OK";

            #endregion

            #region Request
            updateIsse = new PUT_UpdateOneIssueRequest(idProblema);

            updateIsse.SetJsonBoby(summary, categoryName);

            response = updateIsse.ExecuteRequest();
            #endregion

            #region Assert
            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeExpected, response.StatusCode.ToString());
            });
            #endregion
        }
コード例 #8
0
        public void AddAttachmentsInAnIssueSucess()
        {
            #region Parameters
            List <string> dataIssue = IssuesBDSteps.ReturnIdIssuesRandom();
            string        issue_id  = dataIssue[0];

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

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

            #region Request
            addAttachments = new POST_AddAttachmentsToIssueRequest(issue_id);

            addAttachments.SetJsonBody(path, nameFile);

            addAttachments.addFile(path, nameFile);

            response = addAttachments.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
        }