示例#1
0
        public void IdInvalidoProblema()
        {
            #region Parameters
            string idProblema   = "99999a";
            string summary      = "Desafio Testes API" + GeneralHelpers.GeraStringAutomatica(2);
            string categoryName = "Testes API" + GeneralHelpers.GeraStringAutomatica(5);

            //Resultado esperado
            string statusCodeEsperado = "NotFound";
            string message            = "Issue #99999 not found";
            string code      = "1100";
            string localized = "Issue 99999 not found.";

            #endregion

            AtualizarUmaTarefaRequest atualizarUmaTarefaRequest = new AtualizarUmaTarefaRequest(idProblema);
            atualizarUmaTarefaRequest.SetJsonBody(summary, categoryName);
            IRestResponse <dynamic> response = atualizarUmaTarefaRequest.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());
            });
        }
示例#2
0
        public void DadosInvalidosEmail()
        {
            #region Parameters
            string username       = GeneralHelpers.GeraStringAutomatica(9);
            string password       = "******";
            string real_name      = GeneralHelpers.GeraStringAutomatica(9);
            string email          = "root@localhost";
            string nameLevel      = "updater";
            string enabled        = "true";
            string protectedLevel = "false";

            //Resultado esperado
            string statusCodeEsperado = "BadRequest";
            string message            = "Email 'root@localhost' already used.";
            string code      = "813";
            string localized = "That email is already being used. Please go back and select another one.";

            #endregion

            CriarUmUsuarioRequest criarUmUsuarioRequest = new CriarUmUsuarioRequest();
            criarUmUsuarioRequest.SetJsonBody(username, password, real_name, email, nameLevel, enabled, protectedLevel);

            IRestResponse <dynamic> response = criarUmUsuarioRequest.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());
            });
        }
示例#3
0
        public void DadosValidos()
        {
            #region Parameters
            string username       = "******" + GeneralHelpers.GeraStringAutomatica(4);
            string password       = "******";
            string real_name      = "larissa" + GeneralHelpers.GeraStringAutomatica(5);
            string email          = "larissa@teste" + GeneralHelpers.GeraNumeroAutomatico(2) + ".com";
            string nameLevel      = "updater";
            string enabled        = "true";
            string protectedLevel = "false";
            #endregion

            CriarUmUsuarioRequest criarUmUsuarioRequest = new CriarUmUsuarioRequest();
            criarUmUsuarioRequest.SetJsonBody(username, password, real_name, email, nameLevel, enabled, protectedLevel);

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



            List <string> dadosCriacao = SolicitacaoDBSteps.RetornaCriacaoUsuarioDB();
            #region ParametersResponse

            //Resultado esperado
            string statusCodeEsperado = "Created";
            string idUser             = dadosCriacao[0];
            string nameUser           = dadosCriacao[1];
            string real_nameUser      = dadosCriacao[2];
            string emailCriacao       = dadosCriacao[3];
            string idAccess_level     = dadosCriacao[4];
            #endregion

            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeEsperado, response.StatusCode.ToString());

                Assert.AreEqual(idUser, response.Data["user"]["id"].ToString());
                Assert.AreEqual(nameUser, response.Data["user"]["name"].ToString());
                Assert.AreEqual(real_nameUser, response.Data["user"]["real_name"].ToString());
                Assert.AreEqual(emailCriacao, response.Data["user"]["email"].ToString());
                Assert.AreEqual(idAccess_level, response.Data["user"]["access_level"]["id"].ToString());
            });
        }
示例#4
0
        public void DadosInvalidosProblema()
        {
            #region Parameters
            List <string> issue_id = SolicitacaoDBSteps.RetornaIdProblemaDB();

            string idProblema   = issue_id[0];
            string summary      = "";
            string categoryName = "Testes API" + GeneralHelpers.GeraStringAutomatica(5);

            //Resultado esperado
            string statusCodeEsperado = "InternalServerError";
            #endregion

            AtualizarUmaTarefaRequest atualizarUmaTarefaRequest = new AtualizarUmaTarefaRequest(idProblema);
            atualizarUmaTarefaRequest.SetJsonBody(summary, categoryName);
            IRestResponse <dynamic> response = atualizarUmaTarefaRequest.ExecuteRequest();


            Assert.AreEqual(statusCodeEsperado, response.StatusCode.ToString());
        }