private void btnVehiculoLEliminar_Click(object sender, EventArgs e) { var row = dgvVehiculos.SelectedCells[0].OwningRow; var vehiculo = _context.Vehiculo.Find(Convert.ToInt32(row.Cells[0].Value)); _vehiculoService.Delete(vehiculo); VehiculoLista_Load(sender, e); }
public void DeleteVehiculo_True(int id) { var mockVehiculoRepository = new Mock <IVehiculoRepository>(); mockVehiculoRepository.Setup(sp => sp.Delete(id)).Returns(true); IVehiculoService vehiculoService = new VehiculoService(mockVehiculoRepository.Object); var resultado = vehiculoService.Delete(id); Assert.True(resultado); }