private void _view_OnSaveData(object sender, EventArgs e) { using (new WaitCursorHandler()) { try { if (_view.TextBoxTotal != null) { _model.total = uint.Parse(_view.TextBoxTotal.Text, NumberStyles.Number); _services.Update(_model); } } catch (ArgumentException ex) { Messages.Error(ex); } catch (DataAccessException ex) { Messages.Error(ex); } finally { ((Form)_view).Close(); } } }
private void ShouldReturnSuccessForUpdate() { var operationSecceded = false; var dataAccessJsonStr = string.Empty; var formattedJsonStr = string.Empty; try { var model = new KasAwalModel() { id = 1, tanggal = DateTime.Now.Date, total = 123456 }; _services.Update(model); operationSecceded = true; } catch (DataAccessException ex) { operationSecceded = ex.DataAccessStatusInfo.OperationSucceeded; dataAccessJsonStr = JsonConvert.SerializeObject(ex.DataAccessStatusInfo); formattedJsonStr = JToken.Parse(dataAccessJsonStr).ToString(); } try { Assert.True(operationSecceded); _testOutputHelper.WriteLine("Data berhasil diubah."); } finally { _testOutputHelper.WriteLine(formattedJsonStr); } }