public static void CadastrarUmBug(string sumarioBug, string projetoNome) { CreateAnIssueRequest createAnIssueRequest = new CreateAnIssueRequest(); Issue issue = new Issue(); Category category = new Category(); Project project = new Project(); string summary = sumarioBug; string description = sumarioBug + " description"; string categoryName = "General"; string projectName = projetoNome; category.name = categoryName; project.name = projectName; issue.summary = summary; issue.description = description; issue.category = category; issue.project = project; createAnIssueRequest.SetJsonBody(issue); //IRestResponse<dynamic> response = createAnIssueRequest.ExecuteRequest(); }
public void Test_CadastrarProblemaComAnexosComSucesso() { #region Parameters CreateAnIssueRequest createAnIssueRequest = new CreateAnIssueRequest(); Issue issue = new Issue(); Category category = new Category(); Project project = new Project(); File file = new File(); string statusEsperado = "Created"; string summary = "Esse report contem um anexo"; string description = "Esse report contem um anexo description"; string categoryName = "General"; string projectName = "Project 03 Update"; string anexoNome = "test.txt"; string anexoConteudo = "VGhpcyBpcyBhIFRFU1QuDQpUaGlzIGlzIGEgVEVTVC4NClRoaXMgaXMgYSBURVNULg0KVGhpcyBpcyBhIFRFU1QuDQpUaGlzIGlzIGEgVEVTVC4="; #endregion #region Acoes category.name = categoryName; project.name = projectName; file.name = anexoNome; file.content = anexoConteudo; files.Add(file); issue.summary = summary; issue.description = description; issue.category = category; issue.project = project; issue.files = files; createAnIssueRequest.SetJsonBody(issue); IRestResponse <dynamic> response = createAnIssueRequest.ExecuteRequest(); #endregion #region Asserts Assert.Multiple(() => { Assert.AreEqual(statusEsperado, response.StatusCode.ToString()); Assert.AreEqual(summary, response.Data.issue.summary.ToString()); Assert.AreEqual(description, response.Data.issue.description.ToString()); Assert.AreEqual(categoryName, response.Data.issue.category.name.ToString()); Assert.AreEqual(projectName, response.Data.issue.project.name.ToString()); //Etc }); #endregion }
public void Test_TentarCadastrarProblemaSemInformarOResumoDoProblema() { #region Parameters CreateAnIssueRequest createAnIssueRequest = new CreateAnIssueRequest(); Issue issue = new Issue(); Category category = new Category(); Project project = new Project(); //string summary = "This is a test issue"; string description = "This is a test description"; string categoryName = "General"; string projectName = "Project 03 Update"; string statusEsperado = "BadRequest"; string mensagemEsperada = "Summary not specified"; string codigoEsperado = "11"; string localizadorEsperado = "A necessary field \"summary\" was empty. Please recheck your inputs."; #endregion #region Acoes category.name = categoryName; project.name = projectName; //issue.summary = summary; issue.description = description; issue.category = category; issue.project = project; createAnIssueRequest.SetJsonBody(issue); IRestResponse <dynamic> response = createAnIssueRequest.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 Test_CadastrarProblemaMinimoInformacoesComSucesso() { #region Parameters CreateAnIssueRequest createAnIssueRequest = new CreateAnIssueRequest(); Issue issue = new Issue(); Category category = new Category(); Project project = new Project(); string statusEsperado = "Created";//201 string summary = "This is a test issue"; string description = "This is a test description"; string categoryName = "General"; string projectName = "Project 03 Update"; #endregion #region Acoes category.name = categoryName; project.name = projectName; issue.summary = summary; issue.description = description; issue.category = category; issue.project = project; createAnIssueRequest.SetJsonBody(issue); IRestResponse <dynamic> response = createAnIssueRequest.ExecuteRequest(); #endregion #region Asserts Assert.Multiple(() => { Assert.AreEqual(statusEsperado, response.StatusCode.ToString()); Assert.AreEqual(summary, response.Data.issue.summary.ToString()); Assert.AreEqual(description, response.Data.issue.description.ToString()); Assert.AreEqual(categoryName, response.Data.issue.category.name.ToString()); Assert.AreEqual(projectName, response.Data.issue.project.name.ToString()); //Etc }); #endregion }
public static ResponseDomain CriandoUmBug(string summary, string description, string additionalInformation, int projectId, string projectName, string tagName, string statusCodeExpected) { ResponseDomain responseDomain = new ResponseDomain(); CreateAnIssueRequest createAnIssueRequest = new CreateAnIssueRequest(); createAnIssueRequest.SetJsonBody(summary, description, additionalInformation, projectId, projectName, tagName); IRestResponse <dynamic> response = createAnIssueRequest.ExecuteRequest(); if (!response.StatusCode.ToString().Equals(statusCodeExpected)) { throw new Exception("Erro ao executar a requisição."); } responseDomain.Content = response.Content.ToString(); return(responseDomain); }
public void Test_CadastrarProblemaMinimoInformacoesComSucessoDDT(ArrayList testData) { #region Parameters string statusEsperado = "Created"; string summary = testData[0].ToString(); string description = testData[1].ToString(); string categoryName = testData[2].ToString(); string projectName = testData[3].ToString(); #endregion #region Acoes category.name = categoryName; project.name = projectName; issue.summary = summary; issue.description = description; issue.category = category; issue.project = project; createAnIssueRequest.SetJsonBody(issue); IRestResponse <dynamic> response = createAnIssueRequest.ExecuteRequest(); #endregion #region Asserts Assert.Multiple(() => { Assert.AreEqual(statusEsperado, response.StatusCode.ToString()); Assert.AreEqual(summary, response.Data.issue.summary.ToString()); Assert.AreEqual(description, response.Data.issue.description.ToString()); Assert.AreEqual(categoryName, response.Data.issue.category.name.ToString()); Assert.AreEqual(projectName, response.Data.issue.project.name.ToString()); //Etc }); #endregion }
public void Test_CadastrarProblemaTodasInformacoesComSucesso() { #region Parameters CreateAnIssueRequest createAnIssueRequest = new CreateAnIssueRequest(); string statusEsperado = "Created";//201 string summary = "Sumary Issue 09 Test Post"; string description = "Sumary Issue 09 Test Post description"; string additional_information = "More info about the issue"; int projectId = 3; string projectName = "Project 03 Update"; int categoryid = 5; string categoryname = "bugtracker"; string handlername = "vboctor"; int view_stateid = 10; string view_statename = "public"; string priorityname = "normal"; string severityname = "trivial"; string reproducibilityname = "always"; bool sticky = false; int custom_fieldsfieldid = 4; string custom_fieldsfieldName = "The City"; string custom_fieldsValue = "Seattle"; string tagsname = "mantishub"; #endregion #region Acoes project.id = projectId; project.name = projectName; category.id = categoryid; category.name = categoryname; handler.name = handlername; viewState.id = view_stateid; viewState.name = view_statename; priority.name = priorityname; severity.name = severityname; reproducibility.name = reproducibilityname; field.id = custom_fieldsfieldid; field.name = custom_fieldsfieldName; customField.value = custom_fieldsValue; customField.field = field; customFields.Add(customField); tag.name = tagsname; tags.Add(tag); //montando body issue.summary = summary; issue.description = description; issue.additional_information = additional_information; issue.category = category; issue.project = project; issue.category = category; issue.handler = handler; issue.view_state = viewState; issue.priority = priority; issue.severity = severity; issue.reproducibility = reproducibility; issue.sticky = sticky; //issue.custom_fields = customFields; issue.tags = tags; createAnIssueRequest.SetJsonBody(issue); IRestResponse <dynamic> response = createAnIssueRequest.ExecuteRequest(); #endregion #region Asserts Assert.Multiple(() => { Assert.AreEqual(statusEsperado, response.StatusCode.ToString()); Assert.AreEqual(summary, response.Data.issue.summary.ToString()); Assert.AreEqual(description, response.Data.issue.description.ToString()); Assert.AreEqual(additional_information, response.Data.issue.additional_information.ToString()); Assert.AreEqual(projectName, response.Data.issue.project.name.ToString()); //Etc }); #endregion }