private void btnGuardar_Click(object sender, RoutedEventArgs e) { try { if(!Validate()) return; var pass = new ProyectoSocialEncrypter().EncryptString(txtPass.Password); var admin = new Administradore { Nombre = txtNombre.Text, Apellido = txtApellido.Text, Nick = txtNick.Text, Pass = pass, Confirmar = pass }; var adminBl = new AdministradorBl(); if (adminBl.Agregar(admin) > 0) { MessageBox.Show("El registro se agregó correctamente"); txtNombre.Clear(); txtApellido.Clear(); txtNick.Clear(); txtPass.Clear(); txtConfirmarpass.Clear(); } } catch (Exception ex) { MessageBox.Show("Lo sentimos algo ocurrió mal" + "Advertencia" + ex.Message); } }
public void TestMostrarAdministrador() { const int expected = 0; var adminBl = new AdministradorBl(); var actual = adminBl.ObtenerTodos().Count(); Assert.AreNotEqual(expected, actual); }
public void TestEliminarrAdministrador() { const int expected = 1; var adminBl = new AdministradorBl(); var actual = adminBl.Eliminar(new Administradore { Id = 1 }); Assert.AreEqual(actual, expected); }
public void TestAgregarAdministrador() { const int expected = 1; var administrador = new Administradore { Nombre = "Papaya", Apellido = "Papa", Nick = "Pepo", Pass = "******" }; var adminBl = new AdministradorBl(); var actual = adminBl.Agregar(administrador); Assert.AreEqual(expected, actual); }
public void TestModificarAdministrador() { const int expected = 1; var administrador = new Administradore { Nombre = "Patata", Apellido = "Popa", Nick = "Pipo", Pass = "******", Id = 1 }; var adminBl = new AdministradorBl(); var actual = adminBl.Modificar(administrador); Assert.AreEqual(expected, actual); }