public void DadosInvalidosIdProjetoLetra() { #region Parameters string project_id = "aaaaa"; string nomeProjeto = "V." + GeneralHelpers.GeraNumeroAutomatico(2); #endregion #region ParametersResponse //Resultado esperado string statusCodeEsperado = "BadRequest"; string message = "'project_id' must be numeric"; string code = "29"; string localized = "Invalid value for 'project_id'"; #endregion AdicionarVersaoRequest adicionarVersaoRequest = new AdicionarVersaoRequest(project_id); adicionarVersaoRequest.SetJsonBody(nomeProjeto); IRestResponse <dynamic> response = adicionarVersaoRequest.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()); }); }
public void DadosValidos() { #region Parameters string id = "1"; string name = "Projeto Testes Automacao " + GeneralHelpers.GeraNumeroAutomatico(3); string idStatus = "10"; string nameStatus = "development"; string labelStatus = "development"; string description = "Desafio Teste de API"; string file_path = "/tmp/"; string nameView_state = "public"; string labelView_state = "public"; //Resultado esperado string statusCodeEsperado = "Created"; #endregion CriarUmProjetoRequest criarUmProjetoRequest = new CriarUmProjetoRequest(); criarUmProjetoRequest.SetJsonBody(name, nameStatus, labelStatus, description, file_path, nameView_state, labelView_state); IRestResponse <dynamic> response = criarUmProjetoRequest.ExecuteRequest(); Assert.Multiple(() => { Assert.AreEqual(statusCodeEsperado, response.StatusCode.ToString()); Assert.AreEqual(name, response.Data["project"]["name"].ToString()); Assert.AreEqual(description, response.Data["project"]["description"].ToString()); StringAssert.IsMatch("(\\d+)", response.Data["project"]["id"].ToString()); }); }
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()); }); }
public void DadosValidos() { #region Parameters List <string> idProjesto = SolicitacaoDBSteps.RetornaIdNomeAleatorioProjetoDB(); string project_id = idProjesto[0]; string nomeProjeto = "V." + GeneralHelpers.GeraNumeroAutomatico(2); //Resultado esperado string statusCodeEsperado = "NoContent"; #endregion AdicionarVersaoRequest adicionarVersaoRequest = new AdicionarVersaoRequest(project_id); adicionarVersaoRequest.SetJsonBody(nomeProjeto); IRestResponse <dynamic> response = adicionarVersaoRequest.ExecuteRequest(); Assert.AreEqual(statusCodeEsperado, response.StatusCode.ToString()); }