public void DeleteLaptop() { IRepositorio rep = new RepositorioMySQL(); try { rep.Delete("Dell Latitude 5410"); } catch (Exception ex) { } Assert.IsNull(rep.Consult("Dell Latitude 5410")); }
public void CreateLaptop() { IRepositorio rep = new RepositorioMySQL(); try { rep.Create(new Laptop("Dell Latitude 5410", 16, 500)); } catch (Exception ex) { } Assert.IsNotNull(rep.Consult("Dell Latitude 5410")); }
public void ListLaptops() { List <Laptop> laptops = null; IRepositorio rep = new RepositorioMySQL(); try { laptops = rep.List(); } catch (Exception ex) { } Assert.IsNotNull(laptops); }
public void ConsultLaptop() { Laptop lap = null; IRepositorio rep = new RepositorioMySQL(); try { lap = rep.Consult("Lenovo"); } catch (Exception ex) { } Assert.IsNotNull(lap); }
private void ListLaptops() { IRepositorio rep = new RepositorioMySQL(); try { gridLaptops.DataSource = null; gridLaptops.DataSource = rep.List(); gridLaptops.Refresh(); } catch (Exception ex) { MessageBox.Show($"Ocorreu um erro: {ex.Message}"); } }
private void btnSend_Click(object sender, EventArgs e) { IRepositorio rep = new RepositorioMySQL(); try { rep.Create(laptop: new Laptop(txtBrand.Text, int.Parse(txtRam.Text), int.Parse(txtStorage.Text))); ListLaptops(); MessageBox.Show(text: $"Notebook {txtBrand.Text} de {txtRam.Text}GB de RAM e {txtStorage.Text} de armazenamento foi adicionado."); } catch (Exception ex) { MessageBox.Show(text: $"Ocorreu um erro: {ex.Message}"); } }