public editarRol ( long identity, string description, List |
||
identity | long | |
description | string | |
grants | List |
|
revokes | List |
|
nuevoCentro | long | |
Résultat | void |
protected void acceptButton_Click(object sender, EventArgs e) { try { List<string> revokes = new List<string>(); //bool flag = false; foreach (ListItem it in permisos_CBList.Items) { if (it.Selected == false) { revokes.Add(it.Text); //flag = true; } } List<string> grants = new List<string>(); foreach (ListItem it in otrosPermisos_CBList.Items) { if (it.Selected == true) { grants.Add(it.Text); //flag = true; } } /*if (flag) {*/ BL.Rol rl = new Rol(); long rolId = rl.getRolID(descripciones_DDList.SelectedItem.Text); AdministradordeSistema admin = new AdministradordeSistema(); Security sec = new Security(); long centro = sec.getCentroId(centros.Text); admin.editarRol(rolId, descripciones_DDList.SelectedItem.Text, grants, revokes, centro); Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Editado')", true); setCheckBoxes(); /*} else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol No Editado')", true); }*/ } catch (Exception ex) { Session["Error_Msg"] = ex.Message; Response.Redirect("~/Error.aspx", true); } }
public void editarRolTest() { AdministradordeSistema target = new AdministradordeSistema(); // TODO: Initialize to an appropriate value long identity = 18; // TODO: Initialize to an appropriate value string description = "Algo"; // TODO: Initialize to an appropriate value List<string> grants = new List<string>(); // TODO: Initialize to an appropriate value List<string> revokes = new List<string>(); // TODO: Initialize to an appropriate value grants.Add("Codi"); revokes.Add("otro1"); bool flag = true; try { target.editarRol(identity, description, grants, revokes, 2); } catch(Exception) { flag = false; } Assert.IsTrue(flag); }