Exemple #1
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
        }
Exemple #2
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
        }
Exemple #3
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
        }
Exemple #4
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
        }
Exemple #5
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
        }
Exemple #6
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
        }
Exemple #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
        }
Exemple #8
0
        public void MonitoredIssueSucess()
        {
            #region Parameters
            List <string> dataIssue = IssuesBDSteps.GetOneIssue();
            string        issue_id  = dataIssue[0];

            //List<string> dataProject = ProjectsBDSteps.ReturnProjectAndID();
            //string projectId = dataProject[0];

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

            #region Request
            monitorIssue = new POST_MonitorsIssueRequest(issue_id);

            response = monitorIssue.ExecuteRequest();
            #endregion

            #region Assert
            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeExpected, response.StatusCode.ToString());
            });
            #endregion
        }
Exemple #9
0
        public void GetOneIssueSucess()
        {
            #region Parameters
            List <string> dataIssue = IssuesBDSteps.ReturnIssuesRandom();
            string        issue_id  = dataIssue[0];

            //Expected Result
            string statusCodeExpected = "OK";

            string summary     = dataIssue[1];
            string description = dataIssue[2];
            string nameProject = dataIssue[4];

            #endregion

            #region Request
            oneIssue = new GET_OneIssueRequest(issue_id);

            response = oneIssue.ExecuteRequest();
            #endregion

            #region Assert
            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeExpected, response.StatusCode.ToString());
                Assert.AreEqual(summary, response.Data["issues"][0]["summary"].ToString());
                Assert.AreEqual(description, response.Data["issues"][0]["description"].ToString());
                Assert.AreEqual(nameProject, response.Data["issues"][0]["project"]["name"].ToString());
            });
            #endregion
        }
Exemple #10
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
        }
Exemple #11
0
        public void DeleteAnIssueNote()
        {
            #region Parameters
            List <string> dataIssue     = IssuesBDSteps.GetNoteIssue();
            string        issue_id      = dataIssue[0];
            string        issue_note_id = dataIssue[1];

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

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

            response = deleteNote.ExecuteRequest();
            #endregion

            #region Assert
            Assert.AreEqual(statusCodeExpected, response.StatusCode.ToString());
            #endregion
        }