private void _view_OnUpdateData(object sender, EventArgs e) { using (new WaitCursorHandler()) { ListDataGrid listDataGrid = null; if (sender is ListDataGrid) { listDataGrid = (ListDataGrid)sender; } else { listDataGrid = _view.ListDataGrid; } if (listDataGrid != null && listDataGrid.SelectedItem != null) { var model = _services.GetById(((TipeModel)listDataGrid.SelectedItem).id); if (model != null) { var view = new TipeEntryView(false, model); view.OnSaveData += TipeEntryView_OnSaveData; view.ShowDialog(); } } } }
public void ShouldReturnModelMatchingId() { TipeModel model = null; var idToGet = 1; try { model = (TipeModel)_services.GetById(idToGet); } catch (DataAccessException ex) { _testOutputHelper.WriteLine(ex.DataAccessStatusInfo.GetFormatedValues()); } Assert.True(model != null); Assert.True(model.id == idToGet); if (model != null) { TestsHelper.WriteModel(_testOutputHelper, model); } }