예제 #1
0
        public void DadosValidos()
        {
            #region Execucao Query Deletar SubProjetos
            SolicitacaoDBSteps.DeletaSubprojetosDB();
            #endregion

            #region Parameters
            List <string> idProjeto  = SolicitacaoDBSteps.RetornaIdNomeAleatorioProjetoDB();
            string        project_id = idProjeto[0];

            List <string> nameProjeto = SolicitacaoDBSteps.RetornaNomeAleatorioProjetoDB();

            string nomeProjeto = nameProjeto[0];

            //Resultado esperado
            string statusCodeEsperado = "BadRequest";


            #endregion

            CriarSubProjetoRequest criarSubProjetoRequest = new CriarSubProjetoRequest(project_id);
            criarSubProjetoRequest.SetJsonBody(nomeProjeto);

            IRestResponse <dynamic> response = criarSubProjetoRequest.ExecuteRequest();

            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeEsperado, response.StatusCode.ToString());
            });
        }
예제 #2
0
        public void DadosInvalidos()
        {
            List <string> dadosCriacao = SolicitacaoDBSteps.RetornaNomeAleatorioProjetoDB();

            #region Parameters

            string name            = dadosCriacao[0];
            string nameStatus      = "development";
            string labelStatus     = "development";
            string description     = "Desafio Teste de API";
            string file_path       = "/tmp/";
            string nameView_state  = "public";
            string labelView_state = "public";
            #endregion

            CriarUmProjetoRequest criarUmProjetoRequest = new CriarUmProjetoRequest();
            criarUmProjetoRequest.SetJsonBody(name, nameStatus, labelStatus, description, file_path, nameView_state, labelView_state);

            IRestResponse <dynamic> response = criarUmProjetoRequest.ExecuteRequest();

            #region ParametersResponse
            //Resultado esperado
            string statusCodeEsperado = "InternalServerError";

            #endregion


            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeEsperado, response.StatusCode.ToString());
            });
        }
예제 #3
0
        public void DadosValidos()
        {
            List <string> nomeProjeto = SolicitacaoDBSteps.RetornaNomeAleatorioProjetoDB();


            #region Parameters
            string summary      = "TestesAutomatizadosApi";
            string description  = "Descricao do Projeto.";
            string categoryName = "Bug";
            string projectName  = nomeProjeto[0];
            string nomePriority = "normal";
            #endregion

            CriarUmaTarefaRequest criarUmaTarefaRequest = new CriarUmaTarefaRequest();
            criarUmaTarefaRequest.SetJsonBody(summary, description, categoryName, projectName, nomePriority);

            IRestResponse <dynamic> response = criarUmaTarefaRequest.ExecuteRequest();


            #region ParametersResponse
            //Resultado esperado
            string statusCodeEsperado = "Created";
            #endregion

            List <string> dadosProblema = SolicitacaoDBSteps.RetornaInfoTarefaCriadaDB();

            string idIssues          = dadosProblema[0];
            string summaryA          = dadosProblema[1];
            string descriptionA      = dadosProblema[2];
            string idProject         = dadosProblema[3];
            string nameProject       = dadosProblema[4];
            string idCategory        = dadosProblema[5];
            string nameCategory      = dadosProblema[6];;
            string idReporter        = dadosProblema[7];
            string nameReporter      = dadosProblema[8];
            string real_nameReporter = dadosProblema[9];
            string reporterEmail     = dadosProblema[10];
            string idStatus          = dadosProblema[11];
            string idResolution      = dadosProblema[12];


            Assert.Multiple(() => {
                Assert.AreEqual(statusCodeEsperado, response.StatusCode.ToString());
                Assert.AreEqual(idIssues, response.Data["issue"]["id"].ToString());
                Assert.AreEqual(summaryA, response.Data["issue"]["summary"].ToString());
                Assert.AreEqual(descriptionA, response.Data["issue"]["description"].ToString());
                Assert.AreEqual(idProject, response.Data["issue"]["project"]["id"].ToString());
                Assert.AreEqual(nameProject, response.Data["issue"]["project"]["name"].ToString());
                Assert.AreEqual(idCategory, response.Data["issue"]["category"]["id"].ToString());
                Assert.AreEqual(nameCategory, response.Data["issue"]["category"]["name"].ToString());
                Assert.AreEqual(idReporter, response.Data["issue"]["reporter"]["id"].ToString());
                Assert.AreEqual(nameReporter, response.Data["issue"]["reporter"]["name"].ToString());
                Assert.AreEqual(real_nameReporter, response.Data["issue"]["reporter"]["real_name"].ToString());
                Assert.AreEqual(reporterEmail, response.Data["issue"]["reporter"]["email"].ToString());
                Assert.AreEqual(idStatus, response.Data["issue"]["view_state"]["id"].ToString());
                Assert.AreEqual(idResolution, response.Data["issue"]["resolution"]["id"].ToString());
            });
        }
예제 #4
0
        public void DadosInvalidosNomeProjeto()
        {
            List <string> dadosCriacao = SolicitacaoDBSteps.RetornaNomeAleatorioProjetoDB();

            #region Parameters

            List <string> idProjesto = SolicitacaoDBSteps.RetornaIdNomeAleatorioProjetoDB();
            string        project_id = idProjesto[0];

            string nomeProjeto = "NomeInexistente Teste";

            #endregion


            #region ParametersResponse
            //Resultado esperado
            string statusCodeEsperado = "NotFound";
            string message            = "Project 'NomeInexistente Teste' not found";
            string code      = "700";
            string localized = "Project \"NomeInexistente Teste\" not found.";
            #endregion


            CriarSubProjetoRequest criarSubProjetoRequest = new CriarSubProjetoRequest(project_id);
            criarSubProjetoRequest.SetJsonBody(nomeProjeto);

            IRestResponse <dynamic> response = criarSubProjetoRequest.ExecuteRequest();

            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeEsperado, response.StatusCode.ToString());
                Assert.AreEqual(message, response.Data["message"].ToString());
                Assert.AreEqual(code, response.Data["code"].ToString());
                Assert.AreEqual(localized, response.Data["localized"].ToString());
            });
        }