public void Test_DeletarUmaNotaDeUmProblemaComSucesso() { #region Parameters DeleteAnIssueNoteRequest deleteAnIssueNoteRequest; string statusEsperado = "OK"; int idIssue = 6; int idNota = 1; string textoNota = "test note"; string viewStateName = "public"; string reporteName = "Gerry"; #endregion #region Acoes viewState.name = viewStateName; reporter.name = reporteName; note.text = textoNota; note.view_state = viewState; note.reporter = reporter; deleteAnIssueNoteRequest = new DeleteAnIssueNoteRequest(idIssue, idNota); deleteAnIssueNoteRequest.SetJsonBody(note); IRestResponse <dynamic> response = deleteAnIssueNoteRequest.ExecuteRequest(); #endregion #region Asserts Assert.AreEqual(statusEsperado, response.StatusCode.ToString()); #endregion }
public void DeletandoNotaIdBugIncorreto() { #region Inserindo um novo projeto string projectName = "DeletandoNotaBugIdNotaIncorreto"; var projetoCriadoDB = projectsDBSteps.InseriProjetoDB(projectName); #endregion #region Inserindo um novo bug string summary = "DeletandoNotaBugIdNotaIncorreto"; var bugCriadoDB = issuesDBSteps.InseriBugDB(projetoCriadoDB.ProjectId, summary); #endregion #region Inserindo uma nota string note = "DeletandoNotaIdBugIncorreto"; string bugNoteId = issuesDBSteps.InserirNotaBugDB(bugCriadoDB.BugId, note); #endregion #region Parameters string bugId = "999999"; //Resultado Esperadp string statusCodeExpected = "BadRequest"; #endregion DeleteAnIssueNoteRequest deleteAnIssueNoteRequest = new DeleteAnIssueNoteRequest(bugId, bugNoteId); IRestResponse <dynamic> response = deleteAnIssueNoteRequest.ExecuteRequest(); var consultaNotaBugDB = issuesDBSteps.ConsultaNotaBugDB(bugCriadoDB.BugId, note); GeneralHelpers.ValidaStatusCodeComComandoNodeJS(statusCodeExpected, response.StatusCode.ToString()); Assert.IsNotNull(consultaNotaBugDB, "O registro da nota foi excluído."); string[] arrayRegex = new string[] { "\"message\":(.*?)\"Issue note doesn't belong to issue\"", "\"localized\":(.*?)\"Invalid value for 'id'\"", }; MatchCollection matches; foreach (string regex in arrayRegex) { matches = new Regex(regex).Matches(response.Content); Assert.That(matches.Count > 0, "Esperado: " + regex + " Encontrado:" + response.Content); } projectsDBSteps.DeletaProjetoDB(projetoCriadoDB.ProjectId); issuesDBSteps.DeletaBugDB(bugCriadoDB.BugId); issuesDBSteps.DeletaTextoBugDB(bugCriadoDB.BugId); issuesDBSteps.DeletaTextoNotaBugDB(bugNoteId, note); issuesDBSteps.DeletaNotaBugDB(bugCriadoDB.BugId, consultaNotaBugDB[0]); }
public void Test_TentarDeletaUmaNotaQueNaoExiste() { #region Parameters DeleteAnIssueNoteRequest deleteAnIssueNoteRequest; string statusEsperado = "NotFound"; int idIssue = 6; int idNota = 100; string textoNota = "test note"; string viewStateName = "public"; string reporteName = "Gerry"; string mensagemEsperada = "Issue note #100 not found"; string codigoEsperado = "600"; string localizadorEsperado = "Note not found."; #endregion #region Acoes viewState.name = viewStateName; reporter.name = reporteName; note.text = textoNota; note.view_state = viewState; note.reporter = reporter; deleteAnIssueNoteRequest = new DeleteAnIssueNoteRequest(idIssue, idNota); deleteAnIssueNoteRequest.SetJsonBody(note); IRestResponse <dynamic> response = deleteAnIssueNoteRequest.ExecuteRequest(); #endregion #region Asserts Assert.Multiple(() => { Assert.AreEqual(statusEsperado, response.StatusCode.ToString()); Assert.AreEqual(mensagemEsperada, response.Data.message.ToString()); Assert.AreEqual(codigoEsperado, response.Data.code.ToString()); Assert.AreEqual(localizadorEsperado, response.Data.localized.ToString()); }); #endregion }
public void DeletandoNotaBugIdNotaInexistente() { #region Inserindo um novo projeto string projectName = "DeletandoNotaBugIdNotaInexistente"; var projetoCriadoDB = projectsDBSteps.InseriProjetoDB(projectName); #endregion #region Inserindo um novo bug string summary = "DeletandoNotaBugIdNotaInexistente"; var bugCriadoDB = issuesDBSteps.InseriBugDB(projetoCriadoDB.ProjectId, summary); #endregion #region Parameters string bugNoteId = "99999"; //Resultado Esperado string statusCodeExpected = "NotFound"; #endregion DeleteAnIssueNoteRequest deleteAnIssueNoteRequest = new DeleteAnIssueNoteRequest(bugCriadoDB.BugId.ToString(), bugNoteId); IRestResponse <dynamic> response = deleteAnIssueNoteRequest.ExecuteRequest(); GeneralHelpers.ValidaStatusCodeComComandoNodeJS(statusCodeExpected, response.StatusCode.ToString()); string[] arrayRegex = new string[] { "\"message\":(.*?)\"Issue note (.*?)#" + bugNoteId + "(.*?) not found\"", "\"localized\":(.*?)\"Note not found.\"", }; MatchCollection matches; foreach (string regex in arrayRegex) { matches = new Regex(regex).Matches(response.Content); Assert.That(matches.Count > 0, "Esperado: " + regex + " Encontrado:" + response.Content); } projectsDBSteps.DeletaProjetoDB(projetoCriadoDB.ProjectId); issuesDBSteps.DeletaBugDB(bugCriadoDB.BugId); issuesDBSteps.DeletaTextoBugDB(bugCriadoDB.BugId); }
public void DeletandoNotaBug() { #region Inserindo um novo projeto string projectName = "DeletandoNotaBug"; var projetoCriadoDB = projectsDBSteps.InseriProjetoDB(projectName); #endregion #region Inserindo um novo bug string summary = "DeletandoNotaBug"; var bugCriadoDB = issuesDBSteps.InseriBugDB(projetoCriadoDB.ProjectId, summary); #endregion #region Inserindo uma nota string note = "DeletandoNotaBug"; string bugNoteId = issuesDBSteps.InserirNotaBugDB(bugCriadoDB.BugId, note); #endregion #region Parameters //Resultado Esperadp string statusCodeExpected = "OK"; #endregion DeleteAnIssueNoteRequest deleteAnIssueNoteRequest = new DeleteAnIssueNoteRequest(bugCriadoDB.BugId.ToString(), bugNoteId); IRestResponse <dynamic> response = deleteAnIssueNoteRequest.ExecuteRequest(); var consultaNotaBugDB = issuesDBSteps.ConsultaNotaBugDB(bugCriadoDB.BugId, note); GeneralHelpers.ValidaStatusCodeComComandoNodeJS(statusCodeExpected, response.StatusCode.ToString()); Assert.IsNull(consultaNotaBugDB, "O registro da nota não foi excluído."); projectsDBSteps.DeletaProjetoDB(projetoCriadoDB.ProjectId); issuesDBSteps.DeletaBugDB(bugCriadoDB.BugId); issuesDBSteps.DeletaTextoBugDB(bugCriadoDB.BugId); issuesDBSteps.DeletaTextoNotaBugDB(bugNoteId, note); issuesDBSteps.DeletaHistoricoBugDB(bugCriadoDB.BugId); }